mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-07 02:51:50 +00:00
- moveCursor(extend=true) now collapses to the bare cursor when the computed offset equals the existing anchor instead of leaving a zero-length sel. Without this, Shift+Left at col 0 / Shift+Home at start would silently hide the hardware cursor (selected truthy) without rendering any highlight. - _tui_need_npm_install also catches UnicodeDecodeError so a corrupted / non-UTF8 lockfile falls back to the mtime path the docstring promises instead of crashing. Made-with: Cursor
This commit is contained in:
parent
e7091bb326
commit
e0e67a99bb
2 changed files with 5 additions and 5 deletions
|
|
@ -868,7 +868,7 @@ def _tui_need_npm_install(root: Path) -> bool:
|
||||||
try:
|
try:
|
||||||
wanted = json.loads(lock.read_text(encoding="utf-8")).get("packages") or {}
|
wanted = json.loads(lock.read_text(encoding="utf-8")).get("packages") or {}
|
||||||
installed = json.loads(marker.read_text(encoding="utf-8")).get("packages") or {}
|
installed = json.loads(marker.read_text(encoding="utf-8")).get("packages") or {}
|
||||||
except (OSError, json.JSONDecodeError):
|
except (OSError, UnicodeDecodeError, json.JSONDecodeError):
|
||||||
return lock.stat().st_mtime > marker.stat().st_mtime
|
return lock.stat().st_mtime > marker.stat().st_mtime
|
||||||
|
|
||||||
def comparable(pkg: dict) -> dict:
|
def comparable(pkg: dict) -> dict:
|
||||||
|
|
|
||||||
|
|
@ -638,14 +638,14 @@ export function TextInput({
|
||||||
|
|
||||||
const moveCursor = (next: number, extend = false) => {
|
const moveCursor = (next: number, extend = false) => {
|
||||||
const c = snapPos(vRef.current, next)
|
const c = snapPos(vRef.current, next)
|
||||||
|
const anchor = selRef.current?.start ?? curRef.current
|
||||||
|
|
||||||
if (extend) {
|
if (!extend || anchor === c) {
|
||||||
const anchor = selRef.current?.start ?? curRef.current
|
clearSel()
|
||||||
|
} else {
|
||||||
const nextSel = { end: c, start: anchor }
|
const nextSel = { end: c, start: anchor }
|
||||||
selRef.current = nextSel
|
selRef.current = nextSel
|
||||||
setSel(nextSel)
|
setSel(nextSel)
|
||||||
} else {
|
|
||||||
clearSel()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setCur(c)
|
setCur(c)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue