mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-17 18:02:31 +00:00
Merge pull request #1227 from aliou/feat/allow-slash-menu-on-first-line
fix(tui): allow slash command menu on first line with existing text
This commit is contained in:
commit
52638e1c4e
2 changed files with 6 additions and 6 deletions
|
|
@ -2,6 +2,10 @@
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Slash command menu now triggers on the first line even when other lines have content, allowing commands to be prepended to existing text ([#1227](https://github.com/badlogic/pi-mono/pull/1227) by [@aliou](https://github.com/aliou))
|
||||||
|
|
||||||
## [0.51.5] - 2026-02-04
|
## [0.51.5] - 2026-02-04
|
||||||
|
|
||||||
## [0.51.4] - 2026-02-03
|
## [0.51.4] - 2026-02-03
|
||||||
|
|
|
||||||
|
|
@ -1884,13 +1884,9 @@ export class Editor implements Component, Focusable {
|
||||||
this.setCursorCol(newCol);
|
this.setCursorCol(newCol);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Slash menu only allowed when all other lines are empty (no mixed content)
|
// Slash menu only allowed on the first line of the editor
|
||||||
private isSlashMenuAllowed(): boolean {
|
private isSlashMenuAllowed(): boolean {
|
||||||
for (let i = 0; i < this.state.lines.length; i++) {
|
return this.state.cursorLine === 0;
|
||||||
if (i === this.state.cursorLine) continue;
|
|
||||||
if (this.state.lines[i].trim() !== "") return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper method to check if cursor is at start of message (for slash command detection)
|
// Helper method to check if cursor is at start of message (for slash command detection)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue