phewsh 0.15.6 → 0.15.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/commands/session.js +16 -6
- package/package.json +1 -1
package/commands/session.js
CHANGED
|
@@ -774,7 +774,10 @@ async function main() {
|
|
|
774
774
|
const lineCount = text.split('\n').length;
|
|
775
775
|
if (lineCount > 1 || text.length > 200) {
|
|
776
776
|
pasteCounter++;
|
|
777
|
-
const
|
|
777
|
+
const chars = text.length.toLocaleString('en-US');
|
|
778
|
+
const tag = lineCount > 1
|
|
779
|
+
? `[paste #${pasteCounter}: ${chars} chars, ${lineCount} lines]`
|
|
780
|
+
: `[paste #${pasteCounter}: ${chars} chars]`;
|
|
778
781
|
pendingPastes.set(tag, text);
|
|
779
782
|
lastPaste = text;
|
|
780
783
|
rl.write(tag);
|
|
@@ -825,11 +828,18 @@ async function main() {
|
|
|
825
828
|
return;
|
|
826
829
|
}
|
|
827
830
|
// Re-render so token coloring tracks edits — including the keystroke
|
|
828
|
-
// where the token stops matching and must un-color.
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
831
|
+
// where the token stops matching and must un-color. Deferred one tick:
|
|
832
|
+
// this is a prependListener, so readline hasn't appended the just-typed
|
|
833
|
+
// char yet; without the defer, rl.line is stale by one and /model only
|
|
834
|
+
// ever evaluates as /mode.
|
|
835
|
+
setImmediate(() => {
|
|
836
|
+
try {
|
|
837
|
+
const cur = rl.line || '';
|
|
838
|
+
const special = cur[0] === '/' || cur[0] === '@';
|
|
839
|
+
if (special || wasSpecialInput) rl._refreshLine();
|
|
840
|
+
wasSpecialInput = special;
|
|
841
|
+
} catch { /* never break input */ }
|
|
842
|
+
});
|
|
833
843
|
} catch { /* never break input */ }
|
|
834
844
|
};
|
|
835
845
|
process.stdin.prependListener('keypress', phewshKeypress);
|