Skip to content
This repository was archived by the owner on Jul 30, 2025. It is now read-only.

Commit 1ab48ad

Browse files
committed
fix(plugins/plugin-client-common): show input index ui when using a left strip split
We have a simple heuristic that avoids showing this UI whenever we have more than one split. We can improve this with some knowledge of the existence of left or bottom strips This PR also does some small cleanup of css to remove archaic references to section breaks
1 parent 7cd9a9e commit 1ab48ad

File tree

3 files changed

+35
-53
lines changed

3 files changed

+35
-53
lines changed

plugins/plugin-client-common/src/components/Views/Terminal/Block/Input.tsx

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,6 @@ type InputProps = {
104104
/** Block ordinal to be displayed to user */
105105
displayedIdx?: number
106106

107-
/** section index to be displayed to the user */
108-
sectionIdx?: string
109-
110107
/** needed temporarily to make pty/client happy */
111108
_block?: HTMLElement
112109

@@ -206,19 +203,11 @@ export abstract class InputProvider<S extends State = State> extends React.PureC
206203

207204
private readonly _cancelReEdit = this.cancelReEdit.bind(this)
208205

209-
protected contextContent(
210-
insideBrackets: React.ReactNode = this.props.displayedIdx || this.props.idx + 1
211-
): React.ReactNode {
206+
protected contextContent(insideBrackets: React.ReactNode = this.idx): React.ReactNode {
212207
return this.state.isReEdit ? (
213208
<a href="#" className="kui--block-action" title={strings('Cancel edit')} onClick={this._cancelReEdit}>
214209
<Icons icon="Edit" className="clickable" />
215210
</a>
216-
) : this.props.sectionIdx !== undefined ? (
217-
<span className="repl-context-inner">
218-
{' '}
219-
{/* Helps with vertical alignment */}
220-
&sect;{this.props.sectionIdx}
221-
</span>
222211
) : (
223212
<span className="repl-context-inner">
224213
{' '}
@@ -319,6 +308,18 @@ export abstract class InputProvider<S extends State = State> extends React.PureC
319308
)
320309
}
321310

311+
protected get promptValue() {
312+
return hasValue(this.props.model)
313+
? this.props.model.value
314+
: hasCommand(this.props.model)
315+
? this.props.model.command
316+
: ''
317+
}
318+
319+
protected get idx() {
320+
return this.props.displayedIdx || this.props.idx + 1
321+
}
322+
322323
public render() {
323324
return (
324325
<React.Suspense fallback={<div />}>
@@ -435,11 +436,7 @@ export default class Input extends InputProvider {
435436

436437
private onTextAreaRef(c: HTMLTextAreaElement) {
437438
if (c && (!this.state.prompt || isHTMLInputElement(this.state.prompt) || this.state.isReEdit)) {
438-
let value = hasValue(this.props.model)
439-
? this.props.model.value
440-
: hasCommand(this.props.model)
441-
? this.props.model.command
442-
: ''
439+
let value = this.promptValue
443440

444441
if (isHTMLInputElement(this.state.prompt)) {
445442
if (endsWithBackSlash(this.state.prompt.value)) {

plugins/plugin-client-common/web/scss/components/Terminal/Block.scss

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -99,17 +99,6 @@
9999
}
100100
}
101101

102-
@include SectionBreak {
103-
height: 1px;
104-
background-color: var(--color-sidecar-toolbar-background);
105-
padding: 0;
106-
margin: $section-break-margin;
107-
}
108-
109-
/*@include FinishedBlockWithInputAndOutput {
110-
margin-top: 0.5em;
111-
}*/
112-
113102
@include Block {
114103
@include Context {
115104
padding: calc(#{$inset} / 0.875 + 1px) 0;
@@ -148,6 +137,10 @@
148137
flex-direction: column;
149138
padding: 0.5em 0;
150139

140+
@include OutputOnly {
141+
@include HideContext;
142+
}
143+
151144
@include NotOutputOnly {
152145
@include BlockOutput {
153146
margin-top: 0.5em;
@@ -263,9 +256,6 @@
263256
}
264257
}
265258
}
266-
.repl-output .repl-context {
267-
opacity: 0;
268-
}
269259

270260
&[data-is-output-only] {
271261
/* repl right-hand decorations */

plugins/plugin-client-common/web/scss/components/Terminal/_mixins.scss

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ $input-padding-right: $input-padding-left;
5151
$repl-context-min-width: 2em;
5252
$repl-context-margin-right: 0.5em;
5353

54-
$section-break-margin: 2em 4em 2em 7em;
55-
5654
/** Hover hysteresis for showing action buttons */
5755
$action-hover-delay: 210ms;
5856

@@ -155,14 +153,6 @@ $action-hover-delay: 210ms;
155153
}
156154
}
157155

158-
@mixin SectionBreak {
159-
@include Block {
160-
&[data-is-section-break] {
161-
@content;
162-
}
163-
}
164-
}
165-
166156
@mixin BlockAfterBlock {
167157
li.repl-block + li.repl-block {
168158
@content;
@@ -198,14 +188,16 @@ $action-hover-delay: 210ms;
198188

199189
/** A "T T" layout, i.e. two terminals side-by-side */
200190
@mixin SideBySide {
201-
.repl .kui--terminal-split-container {
202-
&[data-split-count='2'],
203-
&[data-split-count='4'],
204-
&[data-split-count='5'],
205-
&[data-split-count='6'],
206-
&[data-split-count='7'],
207-
&[data-split-count='8'] {
208-
@content;
191+
.kui-tab-content:not([data-has-bottom-stripe]):not([data-has-left-strip]) {
192+
.repl .kui--terminal-split-container {
193+
&[data-split-count='2'],
194+
&[data-split-count='4'],
195+
&[data-split-count='5'],
196+
&[data-split-count='6'],
197+
&[data-split-count='7'],
198+
&[data-split-count='8'] {
199+
@content;
200+
}
209201
}
210202
}
211203
}
@@ -336,13 +328,16 @@ $action-hover-delay: 210ms;
336328
}
337329

338330
/** Hide the In[1] bits */
331+
@mixin HideContext {
332+
.repl-context {
333+
display: none;
334+
}
335+
}
339336
@mixin HideIn {
340337
@include Block {
341338
&[data-is-output-only],
342-
&:not([data-in-sections]):not([data-is-replay]) {
343-
.repl-context {
344-
display: none;
345-
}
339+
&:not([data-is-replay]) {
340+
@include HideContext;
346341
}
347342
}
348343
}

0 commit comments

Comments
 (0)