mirror of
https://github.com/kovidgoyal/kitty.git
synced 2024-11-13 12:09:35 +03:00
Allow disabling ligatures always
This commit is contained in:
parent
6f5ff05c56
commit
934336e642
@ -20,7 +20,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
|
||||
- macOS: Allow opening new kitty tabs/top-level windows from Finder
|
||||
(:pull:`1350`)
|
||||
|
||||
- Add an option :opt:`disable_ligatures_under_cursor` to disable
|
||||
- Add an option :opt:`disable_ligatures` to disable
|
||||
multi-character ligatures under the cursor to make editing easier
|
||||
(:iss:`461`)
|
||||
|
||||
|
@ -256,9 +256,17 @@ Syntax is::
|
||||
|
||||
'''))
|
||||
|
||||
o('disable_ligatures_under_cursor', False, long_text=_('''
|
||||
Render the characters of a multi-character ligature under the cursor
|
||||
individually to make editing more intuitive.
|
||||
|
||||
def disable_ligatures(x):
|
||||
cmap = {'never': 0, 'cursor': 1, 'always': 2}
|
||||
return cmap.get(x.lower(), 0)
|
||||
|
||||
|
||||
o('disable_ligatures', 'never', option_type=disable_ligatures, long_text=_('''
|
||||
Choose how you want to handle multi-character ligatures. The default is to
|
||||
always render them. You can tell kitty to not render them when the cursor is
|
||||
over them by using :code:`cursor` to make editing easier, or have kitty never
|
||||
render them at all by using :code:`never`, if you don't like them.
|
||||
'''))
|
||||
|
||||
|
||||
|
@ -744,7 +744,7 @@ shape(CPUCell *first_cpu_cell, GPUCell *first_gpu_cell, index_type num_cells, hb
|
||||
group_state.last_gpu_cell = first_gpu_cell + (num_cells ? num_cells - 1 : 0);
|
||||
load_hb_buffer(first_cpu_cell, first_gpu_cell, num_cells);
|
||||
|
||||
if (disable_ligature) {
|
||||
if (disable_ligature || OPT(disable_ligatures) == DISABLE_LIGATURES_ALWAYS) {
|
||||
hb_shape(font, harfbuzz_buffer, &no_calt_feature, 1);
|
||||
} else {
|
||||
hb_shape(font, harfbuzz_buffer, NULL, 0);
|
||||
@ -1064,7 +1064,7 @@ render_line(FONTS_DATA_HANDLE fg_, Line *line, index_type lnum, Cursor *cursor)
|
||||
bool disable_ligature_in_line = false;
|
||||
index_type first_cell_in_run, i;
|
||||
attrs_type prev_width = 0;
|
||||
if (cursor != NULL && OPT(disable_ligatures_under_cursor)) {
|
||||
if (cursor != NULL && OPT(disable_ligatures) == DISABLE_LIGATURES_CURSOR) {
|
||||
if (lnum == cursor->y) disable_ligature_in_line = true;
|
||||
}
|
||||
for (i=0, first_cell_in_run=0; i < line->xnum; i++) {
|
||||
|
@ -293,11 +293,12 @@ cell_prepare_to_render(ssize_t vao_idx, ssize_t gvao_idx, Screen *screen, GLfloa
|
||||
|
||||
bool cursor_pos_changed = screen->cursor->x != screen->last_rendered_cursor_x
|
||||
|| screen->cursor->y != screen->last_rendered_cursor_y;
|
||||
bool disable_ligatures = OPT(disable_ligatures) == DISABLE_LIGATURES_CURSOR;
|
||||
|
||||
if (screen->scroll_changed || screen->is_dirty || (OPT(disable_ligatures_under_cursor) && cursor_pos_changed)) {
|
||||
if (screen->scroll_changed || screen->is_dirty || (disable_ligatures && cursor_pos_changed)) {
|
||||
sz = sizeof(GPUCell) * screen->lines * screen->columns;
|
||||
address = alloc_and_map_vao_buffer(vao_idx, sz, cell_data_buffer, GL_STREAM_DRAW, GL_WRITE_ONLY);
|
||||
screen_update_cell_data(screen, address, fonts_data, OPT(disable_ligatures_under_cursor) && cursor_pos_changed);
|
||||
screen_update_cell_data(screen, address, fonts_data, disable_ligatures && cursor_pos_changed);
|
||||
unmap_vao_buffer(vao_idx, cell_data_buffer); address = NULL;
|
||||
changed = true;
|
||||
}
|
||||
|
@ -408,7 +408,7 @@ PYWRAP1(set_options) {
|
||||
S(macos_hide_from_tasks, PyObject_IsTrue);
|
||||
S(macos_thicken_font, PyFloat_AsDouble);
|
||||
S(tab_bar_min_tabs, PyLong_AsUnsignedLong);
|
||||
S(disable_ligatures_under_cursor, PyObject_IsTrue);
|
||||
S(disable_ligatures, PyLong_AsLong);
|
||||
|
||||
GA(tab_bar_style);
|
||||
global_state.tab_bar_hidden = PyUnicode_CompareWithASCIIString(ret, "hidden") == 0 ? true: false;
|
||||
|
@ -11,6 +11,7 @@
|
||||
#define OPT(name) global_state.opts.name
|
||||
|
||||
typedef enum { LEFT_EDGE, TOP_EDGE, RIGHT_EDGE, BOTTOM_EDGE } Edge;
|
||||
typedef enum { DISABLE_LIGATURES_NEVER, DISABLE_LIGATURES_CURSOR, DISABLE_LIGATURES_ALWAYS } DisableLigature;
|
||||
|
||||
typedef struct {
|
||||
double visual_bell_duration, cursor_blink_interval, cursor_stop_blinking_after, mouse_hide_wait, click_interval, wheel_scroll_multiplier, touch_scroll_multiplier;
|
||||
@ -35,7 +36,7 @@ typedef struct {
|
||||
float window_padding_width;
|
||||
Edge tab_bar_edge;
|
||||
unsigned long tab_bar_min_tabs;
|
||||
bool disable_ligatures_under_cursor;
|
||||
DisableLigature disable_ligatures;
|
||||
bool sync_to_monitor;
|
||||
bool close_on_child_death;
|
||||
bool window_alert_on_bell;
|
||||
|
Loading…
Reference in New Issue
Block a user