Skip to content

Commit 5d97eaa

Browse files
Update xterm.js to 6.0, add overview ruler and window options
Upgraded @xterm/xterm and related addons to version 6.0.0 and updated CDN references. Added OverviewRulerOptions and WindowOptions classes, integrated overview ruler and window options into TerminalOptions, and extended Theme with new scrollbar and overview ruler properties. Updated target frameworks and dependencies in the project file, and incremented the package version to 2.3.0.
1 parent 7602e16 commit 5d97eaa

File tree

10 files changed

+286
-95
lines changed

10 files changed

+286
-95
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ To use `@xterm/addon-fit` addon, you need to add the following to your HTML body
8787
Blazor WebAssembly `index.html`
8888
```html
8989
<!-- Add addon-fit.min.js before blazor.webassembly.js and XtermBlazor.min.js -->
90-
<script src="https://cdn.jsdelivr.net/npm/@xterm/addon-fit@0.9.0/lib/addon-fit.min.js"></script>
90+
<script src="https://cdn.jsdelivr.net/npm/@xterm/addon-fit@0.11.0/lib/addon-fit.min.js"></script>
9191

9292
<script src="_framework/blazor.webassembly.js"></script>
9393
<script>navigator.serviceWorker.register('service-worker.js');</script>
@@ -100,7 +100,7 @@ Blazor WebAssembly `index.html`
100100
Blazor Server `_Host.cshtml`
101101
```html
102102
<!-- Add addon-fit.min.js before blazor.server.js and XtermBlazor.min.js -->
103-
<script src="https://cdn.jsdelivr.net/npm/@@xterm/addon-fit@0.9.0/lib/addon-fit.min.js"></script>
103+
<script src="https://cdn.jsdelivr.net/npm/@@xterm/addon-fit@0.11.0/lib/addon-fit.min.js"></script>
104104

105105
<script src="_framework/blazor.server.js"></script>
106106

XtermBlazor.Demo.Server/Pages/_Host.cshtml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@
3333
<a class="dismiss">🗙</a>
3434
</div>
3535

36-
<script src="https://cdn.jsdelivr.net/npm/@@xterm/addon-fit@0.10.0/lib/addon-fit.min.js"></script>
37-
<script src="https://cdn.jsdelivr.net/npm/@@xterm/addon-search@0.15.0/lib/addon-search.min.js"></script>
38-
<script src="https://cdn.jsdelivr.net/npm/@@xterm/addon-web-links@0.11.0/lib/addon-web-links.min.js"></script>
36+
<script src="https://cdn.jsdelivr.net/npm/@@xterm/addon-fit@0.11.0/lib/addon-fit.min.js"></script>
37+
<script src="https://cdn.jsdelivr.net/npm/@@xterm/addon-search@0.16.0/lib/addon-search.min.js"></script>
38+
<script src="https://cdn.jsdelivr.net/npm/@@xterm/addon-web-links@0.12.0/lib/addon-web-links.min.js"></script>
3939

4040
<script src="_framework/blazor.server.js"></script>
4141

XtermBlazor.Demo.Wasm/wwwroot/index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
<a class="dismiss">🗙</a>
2525
</div>
2626

27-
<script src="https://cdn.jsdelivr.net/npm/@xterm/addon-fit@0.10.0/lib/addon-fit.min.js"></script>
28-
<script src="https://cdn.jsdelivr.net/npm/@xterm/addon-search@0.15.0/lib/addon-search.min.js"></script>
29-
<script src="https://cdn.jsdelivr.net/npm/@xterm/addon-web-links@0.11.0/lib/addon-web-links.min.js"></script>
27+
<script src="https://cdn.jsdelivr.net/npm/@xterm/addon-fit@0.11.0/lib/addon-fit.min.js"></script>
28+
<script src="https://cdn.jsdelivr.net/npm/@xterm/addon-search@0.16.0/lib/addon-search.min.js"></script>
29+
<script src="https://cdn.jsdelivr.net/npm/@xterm/addon-web-links@0.12.0/lib/addon-web-links.min.js"></script>
3030

3131
<script src="_framework/blazor.webassembly.js"></script>
3232
<script>navigator.serviceWorker.register('service-worker.js');</script>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using System.Text.Json.Serialization;
2+
3+
namespace XtermBlazor
4+
{
5+
/// <summary>
6+
/// Options for the overview ruler displayed to the right of the terminal.
7+
/// Note: the overview ruler is only visible when <see cref="Width"/> is set.
8+
/// </summary>
9+
public class OverviewRulerOptions
10+
{
11+
/// <summary>
12+
/// When defined, renders decorations in the overview ruler to the right of
13+
/// the terminal. This must be set in order to see the overview ruler.
14+
/// </summary>
15+
[JsonPropertyName("width")]
16+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
17+
public int? Width { get; set; }
18+
19+
/// <summary>
20+
/// Whether to show the top border of the overview ruler, which uses the
21+
/// theme's overview ruler border color.
22+
/// </summary>
23+
[JsonPropertyName("showTopBorder")]
24+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
25+
public bool? ShowTopBorder { get; set; }
26+
27+
/// <summary>
28+
/// Whether to show the bottom border of the overview ruler, which uses the
29+
/// theme's overview ruler border color.
30+
/// </summary>
31+
[JsonPropertyName("showBottomBorder")]
32+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
33+
public bool? ShowBottomBorder { get; set; }
34+
}
35+
}

XtermBlazor/TerminalOptions.cs

Lines changed: 7 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,6 @@ public class TerminalOptions
118118
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
119119
public bool? DrawBoldTextInBrightColors { get; set; }
120120

121-
/// <summary>
122-
/// The modifier key hold to multiply scroll speed.
123-
/// </summary>
124-
[JsonPropertyName("fastScrollModifier")]
125-
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
126-
public FastScrollModifier? FastScrollModifier { get; set; }
127-
128121
/// <summary>
129122
/// The scroll speed multiplier used for fast scrolling.
130123
/// </summary>
@@ -335,27 +328,6 @@ public class TerminalOptions
335328
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
336329
public Theme Theme { get; set; } = new();
337330

338-
/// <summary>
339-
/// Whether "Windows mode" is enabled. Because Windows backends winpty and
340-
/// conpty operate by doing line wrapping on their side, xterm.js does not
341-
/// have access to wrapped lines.When Windows mode is enabled the following
342-
/// changes will be in effect:
343-
///
344-
/// - Reflow is disabled.
345-
/// - Lines are assumed to be wrapped if the last character of the line is
346-
/// not whitespace.
347-
///
348-
/// When using conpty on Windows 11 version >= 21376, it is recommended to
349-
/// disable this because native text wrapping sequences are output correctly
350-
/// thanks to https://github.com/microsoft/terminal/issues/405
351-
///
352-
/// @deprecated Use {@link windowsPty}. This value will be ignored if
353-
/// windowsPty is set.
354-
/// </summary>
355-
[JsonPropertyName("windowsMode")]
356-
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
357-
public bool? WindowsMode { get; set; }
358-
359331
/// <summary>
360332
/// Compatibility information when the pty is known to be hosted on Windows.
361333
/// Setting this will turn on certain heuristics/workarounds depending on the
@@ -384,25 +356,21 @@ public class TerminalOptions
384356
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
385357
public string? WordSeparator { get; set; }
386358

387-
388-
#pragma warning disable CS1587 // XML comment is not placed on a valid language element
389359
/// <summary>
390360
/// Enable various window manipulation and report features.
391361
/// All features are disabled by default for security reasons.
392362
/// </summary>
393-
//[JsonPropertyName("windowOptions")]
394-
//[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
395-
//public WindowOptions? WindowOptions { get; set; }
396-
#pragma warning restore CS1587 // XML comment is not placed on a valid language element
363+
[JsonPropertyName("windowOptions")]
364+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
365+
public WindowOptions? WindowOptions { get; set; }
397366

398367
/// <summary>
399-
/// The width, in pixels, of the canvas for the overview ruler. The overview
400-
/// ruler will be hidden when not set.
368+
/// Controls the visibility and style of the overview ruler which visualizes
369+
/// decorations underneath the scroll bar.
401370
/// </summary>
402-
[JsonPropertyName("overviewRulerWidth")]
403-
371+
[JsonPropertyName("overviewRuler")]
404372
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
405-
public int? OverviewRulerWidth { get; set; }
373+
public OverviewRulerOptions? OverviewRuler { get; set; }
406374
}
407375

408376
/// <summary>
@@ -467,37 +435,6 @@ public enum CursorInactiveStyle
467435
None
468436
}
469437

470-
/// <summary>
471-
/// The modifier key hold to multiply scroll speed.
472-
/// </summary>
473-
[JsonConverter(typeof(JsonStringEnumMemberConverter))]
474-
public enum FastScrollModifier
475-
{
476-
/// <summary>
477-
/// None
478-
/// </summary>
479-
[EnumMember(Value = "none")]
480-
None,
481-
482-
/// <summary>
483-
/// Alt
484-
/// </summary>
485-
[EnumMember(Value = "alt")]
486-
Alt,
487-
488-
/// <summary>
489-
/// Ctrl
490-
/// </summary>
491-
[EnumMember(Value = "ctrl")]
492-
Ctrl,
493-
494-
/// <summary>
495-
/// Shift
496-
/// </summary>
497-
[EnumMember(Value = "shift")]
498-
Shift
499-
}
500-
501438
/// <summary>
502439
/// What log level to use.
503440
/// </summary>

XtermBlazor/Theme.cs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,35 @@ public class Theme
5656
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
5757
public string? SelectionInactiveBackground { get; set; }
5858

59+
/// <summary>
60+
/// The scrollbar slider background color. Defaults to <c>foreground</c> with 20% opacity.
61+
/// </summary>
62+
[JsonPropertyName("scrollbarSliderBackground")]
63+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
64+
public string? ScrollbarSliderBackground { get; set; }
65+
66+
/// <summary>
67+
/// The scrollbar slider background color when hovered. Defaults to <c>foreground</c> with 40% opacity.
68+
/// </summary>
69+
[JsonPropertyName("scrollbarSliderHoverBackground")]
70+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
71+
public string? ScrollbarSliderHoverBackground { get; set; }
72+
73+
/// <summary>
74+
/// The scrollbar slider background color when clicked. Defaults to <c>foreground</c> with 50% opacity.
75+
/// </summary>
76+
[JsonPropertyName("scrollbarSliderActiveBackground")]
77+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
78+
public string? ScrollbarSliderActiveBackground { get; set; }
79+
80+
/// <summary>
81+
/// The border color of the overview ruler. This visually separates the terminal from the scroll bar
82+
/// when <c>OverviewRulerOptions.width</c> is set. Defaults to black (<c>#000000</c>) when not set.
83+
/// </summary>
84+
[JsonPropertyName("overviewRulerBorder")]
85+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
86+
public string? OverviewRulerBorder { get; set; }
87+
5988
/// <summary>
6089
/// ANSI black (eg. `\x1b[30m`)
6190
/// </summary>

0 commit comments

Comments
 (0)