Refactor: Use a consistent name for beam cursor shape

This commit is contained in:
pagedown 2022-11-19 10:34:50 +08:00
parent ffefd0f581
commit a131f9a82e
No known key found for this signature in database
GPG Key ID: E921CF18AC8FF6EB
4 changed files with 4 additions and 4 deletions

View File

@ -319,7 +319,7 @@ class DiffHandler(Handler):
fg=self.opts.foreground, bg=self.opts.background, fg=self.opts.foreground, bg=self.opts.background,
cursor=self.opts.foreground, select_fg=self.opts.select_fg, cursor=self.opts.foreground, select_fg=self.opts.select_fg,
select_bg=self.opts.select_bg) select_bg=self.opts.select_bg)
self.cmd.set_cursor_shape('bar') self.cmd.set_cursor_shape('beam')
def finalize(self) -> None: def finalize(self) -> None:
self.cmd.set_default_colors() self.cmd.set_default_colors()

View File

@ -180,7 +180,7 @@ class ThemesHandler(Handler):
self.cmd.save_colors() self.cmd.save_colors()
self.cmd.set_line_wrapping(False) self.cmd.set_line_wrapping(False)
self.cmd.set_window_title('Choose a theme for kitty') self.cmd.set_window_title('Choose a theme for kitty')
self.cmd.set_cursor_shape('bar') self.cmd.set_cursor_shape('beam')
def initialize(self) -> None: def initialize(self) -> None:
self.init_terminal_state() self.init_terminal_state()

View File

@ -53,7 +53,7 @@ class LineEdit:
write('\r') write('\r')
if cursor_pos: if cursor_pos:
write(move_cursor_by(cursor_pos, 'right')) write(move_cursor_by(cursor_pos, 'right'))
write(set_cursor_shape('bar')) write(set_cursor_shape('beam'))
def add_text(self, text: str) -> None: def add_text(self, text: str) -> None:
if self.current_input: if self.current_input:

View File

@ -141,7 +141,7 @@ def move_cursor_by(amt: int, direction: str) -> str:
@cmd @cmd
def set_cursor_shape(shape: str = 'block', blink: bool = True) -> str: def set_cursor_shape(shape: str = 'block', blink: bool = True) -> str:
val = {'block': 1, 'underline': 3, 'bar': 5}.get(shape, 1) val = {'block': 1, 'underline': 3, 'beam': 5}.get(shape, 1)
if not blink: if not blink:
val += 1 val += 1
return f'\033[{val} q' return f'\033[{val} q'