mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-02 14:01:20 -03:00
Give scroll-forward a less confusing name
ECMA-48 calls CSI S "scroll up", so use something like that but try to avoid ambiguity.
This commit is contained in:
@@ -198,7 +198,7 @@ Optional Commands
|
||||
|
||||
``\e[ Ps S``
|
||||
- indn
|
||||
- Scroll up Ps lines (aka ``SU`` but terminfo calls it "scroll forward")
|
||||
- Scroll up the content (not the viewport) Ps lines (aka ``SU`` but terminfo calls it "scroll forward")
|
||||
This enables the :ref:`scrollback-push <special-input-functions-scrollback-push>` special input function which is used by :kbd:`ctrl-l`.
|
||||
- ECMA-48
|
||||
* - ``\e[= Ps u``, ``\e[? Ps u``
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
function_key, shift, Key, Modifiers, ViewportPosition,
|
||||
};
|
||||
use crate::reader::reader_test_and_clear_interrupted;
|
||||
use crate::terminal::{SCROLL_FORWARD_SUPPORTED, SCROLL_FORWARD_TERMINFO_CODE};
|
||||
use crate::terminal::{SCROLL_CONTENT_UP_SUPPORTED, SCROLL_CONTENT_UP_TERMINFO_CODE};
|
||||
use crate::threads::iothread_port;
|
||||
use crate::tty_handoff::{
|
||||
get_kitty_keyboard_capability, maybe_set_kitty_keyboard_capability, XTVERSION,
|
||||
@@ -1505,9 +1505,9 @@ fn parse_dcs(&mut self, buffer: &mut Vec<u8>) -> Option<KeyEvent> {
|
||||
format!("Received XTGETTCAP response: {}", str2wcstring(&key))
|
||||
);
|
||||
}
|
||||
if key == SCROLL_FORWARD_TERMINFO_CODE.as_bytes() {
|
||||
SCROLL_FORWARD_SUPPORTED.store(true);
|
||||
FLOG!(reader, "Scroll forward is supported");
|
||||
if key == SCROLL_CONTENT_UP_TERMINFO_CODE.as_bytes() {
|
||||
SCROLL_CONTENT_UP_SUPPORTED.store(true);
|
||||
FLOG!(reader, "SCROLL UP is supported");
|
||||
}
|
||||
return None;
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@
|
||||
QueryCursorPosition, QueryKittyKeyboardProgressiveEnhancements, QueryPrimaryDeviceAttribute,
|
||||
QueryXtgettcap, QueryXtversion,
|
||||
};
|
||||
use crate::terminal::{SCROLL_FORWARD_SUPPORTED, SCROLL_FORWARD_TERMINFO_CODE};
|
||||
use crate::terminal::{SCROLL_CONTENT_UP_SUPPORTED, SCROLL_CONTENT_UP_TERMINFO_CODE};
|
||||
use crate::termsize::{termsize_invalidate_tty, termsize_last, termsize_update};
|
||||
use crate::text_face::parse_text_face;
|
||||
use crate::text_face::TextFace;
|
||||
@@ -2678,7 +2678,7 @@ fn query_capabilities_via_dcs(out: &mut impl Output) {
|
||||
return;
|
||||
}
|
||||
out.write_command(DecsetAlternateScreenBuffer); // enable alternative screen buffer
|
||||
send_xtgettcap_query(out, SCROLL_FORWARD_TERMINFO_CODE);
|
||||
send_xtgettcap_query(out, SCROLL_CONTENT_UP_TERMINFO_CODE);
|
||||
out.write_command(DecrstAlternateScreenBuffer); // disable alternative screen buffer
|
||||
}
|
||||
|
||||
@@ -3946,7 +3946,7 @@ fn handle_readline_command(&mut self, c: ReadlineCmd) {
|
||||
self.clear_screen_and_repaint();
|
||||
}
|
||||
rl::ScrollbackPush => {
|
||||
if !SCROLL_FORWARD_SUPPORTED.load() {
|
||||
if !SCROLL_CONTENT_UP_SUPPORTED.load() {
|
||||
return;
|
||||
}
|
||||
let query = self.blocking_query();
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
use crate::highlight::{HighlightColorResolver, HighlightSpec};
|
||||
use crate::terminal::TerminalCommand::{
|
||||
self, ClearToEndOfLine, ClearToEndOfScreen, CursorDown, CursorLeft, CursorMove, CursorRight,
|
||||
CursorUp, EnterDimMode, ExitAttributeMode, Osc133PromptStart, ScrollForward,
|
||||
CursorUp, EnterDimMode, ExitAttributeMode, Osc133PromptStart, ScrollContentUp,
|
||||
};
|
||||
use crate::terminal::{use_terminfo, BufferedOutputter, CardinalDirection, Output, Outputter};
|
||||
use crate::termsize::{termsize_last, Termsize};
|
||||
@@ -588,8 +588,8 @@ pub fn push_to_scrollback(&mut self, cursor_y: usize) {
|
||||
return;
|
||||
}
|
||||
let mut out = BufferedOutputter::new(self.outp);
|
||||
// Scroll down.
|
||||
out.write_command(ScrollForward(lines_to_scroll));
|
||||
// Move everything to scrollback.
|
||||
out.write_command(ScrollContentUp(lines_to_scroll));
|
||||
// Reposition cursor.
|
||||
out.write_command(CursorMove(CardinalDirection::Up, lines_to_scroll));
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ pub(crate) enum TerminalCommand<'a> {
|
||||
|
||||
// Other terminal features
|
||||
QueryCursorPosition,
|
||||
ScrollForward(usize),
|
||||
ScrollContentUp(usize),
|
||||
|
||||
DecsetShowCursor,
|
||||
DecrstMouseTracking,
|
||||
@@ -182,7 +182,7 @@ fn write(out: &mut impl Output, sequence: &'static [u8]) -> bool {
|
||||
Osc133CommandStart(command) => osc_133_command_start(self, command),
|
||||
Osc133CommandFinished(s) => osc_133_command_finished(self, s),
|
||||
QueryCursorPosition => write(self, b"\x1b[6n"),
|
||||
ScrollForward(lines) => scroll_forward(self, lines),
|
||||
ScrollContentUp(lines) => scroll_content_up(self, lines),
|
||||
DecsetShowCursor => write(self, b"\x1b[?25h"),
|
||||
DecrstMouseTracking => write(self, b"\x1b[?1000l"),
|
||||
DecsetFocusReporting => write(self, b"\x1b[?1004h"),
|
||||
@@ -216,8 +216,8 @@ fn maybe_terminfo(
|
||||
true
|
||||
}
|
||||
|
||||
pub(crate) static SCROLL_FORWARD_SUPPORTED: RelaxedAtomicBool = RelaxedAtomicBool::new(false);
|
||||
pub(crate) static SCROLL_FORWARD_TERMINFO_CODE: &str = "indn";
|
||||
pub(crate) static SCROLL_CONTENT_UP_SUPPORTED: RelaxedAtomicBool = RelaxedAtomicBool::new(false);
|
||||
pub(crate) static SCROLL_CONTENT_UP_TERMINFO_CODE: &str = "indn";
|
||||
|
||||
pub(crate) fn use_terminfo() -> bool {
|
||||
!future_feature_flags::test(FeatureFlag::ignore_terminfo) && TERM.lock().unwrap().is_some()
|
||||
@@ -412,8 +412,8 @@ fn osc_133_command_finished(out: &mut impl Output, exit_status: libc::c_int) ->
|
||||
true
|
||||
}
|
||||
|
||||
fn scroll_forward(out: &mut impl Output, lines: usize) -> bool {
|
||||
assert!(SCROLL_FORWARD_SUPPORTED.load());
|
||||
fn scroll_content_up(out: &mut impl Output, lines: usize) -> bool {
|
||||
assert!(SCROLL_CONTENT_UP_SUPPORTED.load());
|
||||
write_to_output!(out, "\x1b[{}S", lines);
|
||||
true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user