File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -145,7 +145,26 @@ const initTerminal = () => {
145145 term .loadAddon (webLinksAddon)
146146
147147 zerolag = new ZerolagInputAddon ({
148- prompt: { type: ' regex' , pattern: / [$#%❯>] \s * $ / , offset: 2 }
148+ prompt: {
149+ type: ' custom' ,
150+ find : (t ) => {
151+ const buffer = t .buffer .active ;
152+ const cursorY = buffer .cursorY ;
153+ for (let y = cursorY; y >= Math .max (0 , cursorY - 5 ); y-- ) {
154+ const line = buffer .getLine (y);
155+ if (line) {
156+ const str = line .translateToString (true );
157+ const match = str .match (/ [$#%❯>] \s * $ / );
158+ if (match) {
159+ return { row: y, col: match .index + match[0 ].length };
160+ }
161+ }
162+ }
163+ // Fallback to cursor position if prompt not recognized
164+ return { row: buffer .cursorY , col: buffer .cursorX };
165+ }
166+ },
167+ zIndex: 9999
149168 })
150169 term .loadAddon (zerolag)
151170
You can’t perform that action at this time.
0 commit comments