Skip to content

Commit

Permalink
aichat improvements (#667)
Browse files Browse the repository at this point in the history
  • Loading branch information
adred authored Jun 7, 2024
1 parent 1234919 commit d7173c9
Show file tree
Hide file tree
Showing 11 changed files with 303 additions and 222 deletions.
4 changes: 4 additions & 0 deletions assets/default-keybindings.json
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,10 @@
"command": "aichat:clearHistory",
"keys": ["Ctrl:l"]
},
{
"command": "aichat:setCmdInputValue",
"keys": ["Ctrl:Shift:e"]
},
{
"command": "terminal:copy",
"keys": ["Ctrl:Shift:c"]
Expand Down
19 changes: 13 additions & 6 deletions src/app/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,20 @@ class App extends React.Component<{}, {}> {
dcWait: OV<boolean> = mobx.observable.box(false, { name: "dcWait" });
mainContentRef: React.RefObject<HTMLDivElement> = React.createRef();
termThemesLoaded: OV<boolean> = mobx.observable.box(false, { name: "termThemesLoaded" });
chatFocusTimeoutId: NodeJS.Timeout = null;

constructor(props: {}) {
super(props);
if (GlobalModel.isDev) document.body.classList.add("is-dev");
}

componentWillUnmount() {
if (this.chatFocusTimeoutId) {
clearTimeout(this.chatFocusTimeoutId);
this.chatFocusTimeoutId = null;
}
}

@boundMethod
handleContextMenu(e: any) {
let isInNonTermInput = false;
Expand Down Expand Up @@ -68,16 +76,15 @@ class App extends React.Component<{}, {}> {

@boundMethod
openMainSidebar() {
const mainSidebarModel = GlobalModel.mainSidebarModel;
const width = mainSidebarModel.getWidth(true);
mainSidebarModel.saveState(width, false);
GlobalModel.mainSidebarModel.setCollapsed(false);
}

@boundMethod
openRightSidebar() {
const rightSidebarModel = GlobalModel.rightSidebarModel;
const width = rightSidebarModel.getWidth(true);
rightSidebarModel.saveState(width, false);
GlobalModel.rightSidebarModel.setCollapsed(false);
this.chatFocusTimeoutId = setTimeout(() => {
GlobalModel.inputModel.setChatSidebarFocus();
}, 100);
}

@boundMethod
Expand Down
3 changes: 2 additions & 1 deletion src/app/line/linecomps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ class LineActions extends React.Component<{ screen: LineContainerType; line: Lin
screen.getUsedRows(lineutil.getRendererContext(line), line, cmd, 300) * 2,
cmdShouldMarkError(cmd)
);
GlobalModel.sidebarchatModel.setFocus("input", true);
GlobalModel.inputModel.setChatSidebarFocus();
GlobalModel.sidebarchatModel.resetSelectedCodeBlockIndex();
}
}

Expand Down
6 changes: 6 additions & 0 deletions src/app/sidebar/aichat.less
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
.filler {
flex: 1 1 auto;
}

> * {
cursor: default;
user-select: none;
}
}

.chat-msg {
Expand Down Expand Up @@ -78,6 +83,7 @@
font-family: var(--termfontfamily);
font-weight: normal;
line-height: var(--termlineheight);
height: 21px;
}
}
}
Loading

0 comments on commit d7173c9

Please sign in to comment.