add line starring

This commit is contained in:
sawka
2022-12-05 22:59:31 -08:00
parent 5614589922
commit 0620ff5d85
4 changed files with 45 additions and 0 deletions
+20
View File
@@ -389,6 +389,17 @@ class LineCmd extends React.Component<{sw : ScreenWindow, line : LineType, width
let {line} = this.props;
GlobalCommandRunner.swSelectLine(String(line.linenum), "cmd");
}
@boundMethod
clickStar() {
let {line} = this.props;
if (!line.star || line.star == 0) {
GlobalCommandRunner.lineStar(line.lineid, 1);
}
else {
GlobalCommandRunner.lineStar(line.lineid, 0);
}
}
render() {
let {sw, line, width, staticRender, visible} = this.props;
@@ -446,6 +457,15 @@ class LineCmd extends React.Component<{sw : ScreenWindow, line : LineType, width
{this.renderCmdText(cmd, remote)}
</div>
</div>
<div className="flex-spacer"/>
<div className={cn("line-star", {"active": line.star > 0})} onClick={this.clickStar}>
<If condition={!line.star || line.star == 0}>
<i className="fa fa-star-o"/>
</If>
<If condition={line.star > 0}>
<i className="fa fa-star"/>
</If>
</div>
</div>
<div className={cn("terminal-wrapper", {"focus": isFocused}, {"cmd-done": !cmd.isRunning()}, {"zero-height": (termHeight == 0)})}>
<If condition={!isFocused}>
+4
View File
@@ -2299,6 +2299,10 @@ class CommandRunner {
swSetFocus(focusVal : string) : void {
GlobalModel.submitCommand("sw", "set", null, {"focus": focusVal, "nohist": "1"}, true);
}
lineStar(lineId : string, starVal : number) {
GlobalModel.submitCommand("line", "star", [lineId, String(starVal)], {"nohist": "1"}, true);
}
};
function cmdPacketString(pk : FeCmdPacketType) : string {
+20
View File
@@ -407,6 +407,22 @@ html, body, #main {
}
}
.line-star {
display: none;
cursor: pointer;
padding: 3px;
font-size: 1.5rem;
}
.line-star.active {
display: block;
color: @term-bright-yellow;
}
&:hover .line-star {
display: block;
}
&.has-rtnstate .terminal-wrapper {
padding-bottom: 0;
margin-bottom: -5px;
@@ -1420,3 +1436,7 @@ input[type=checkbox] {
font-size: 12px;
margin-left: -3px;
}
.flex-spacer {
flex-grow: 1;
}
+1
View File
@@ -27,6 +27,7 @@ type LineType = {
text : string,
cmdid : string,
contentheight : number,
star : number,
ephemeral? : boolean,
remove? : boolean,
};