Skip to content

Conversation

@mjkloeckner
Copy link
Contributor

Adds an offset to the cursor and the selected text in editor mode, as well as the selected file in file browser mode.

The offset is a constant defined in src/common.h that is added to the y coordinate of the respective cursor when being rendered.

Adds an offset to the cursor and the selected text in editor mode, as
well as the selected file in file browser mode.

The offset is a constant defined in `src/common.h` that is added to the y
coordinate of the respective cursor when being rendered.
@mate-h
Copy link
Contributor

mate-h commented Feb 10, 2023

Could this constant be derived from font metrics to support user customizable fonts in the future?
Relevant docs: https://freetype.org/freetype2/docs/glyphs/glyphs-3.html

linespace = ascent - descent + linegap

@mjkloeckner
Copy link
Contributor Author

Well, I already tested the cursor offset with other fonts (Ubuntu Mono, JetBrains, FiraCode) and the offset looks good in all cases. I leave you some screenshots:

  • Iosevka:

cursor_fix

  • Victor Mono:

cursor_fix_victor_mono

  • Ubuntu Mono:

cursor_fix_ubuntu_mono

I did notice though, that in some fonts (for example Victor Mono) there are characters bigger than the cursor, so maybe what you are saying applies when the cursor size is being computed?

@rexim
Copy link
Member

rexim commented Feb 16, 2023

@mjkloeckner looks good to me! 👍 Thank you for your contribution!

@rexim rexim merged commit 8b684c9 into tsoding:master Feb 16, 2023
BillKek added a commit to BillKek/ded_old_msys2 that referenced this pull request Feb 16, 2023
commit 759c476
Merge: 2993903 563b2fc
Author: Alexey Kutepov <reximkut@gmail.com>
Date:   Thu Feb 16 15:26:42 2023 +0700

    Merge pull request tsoding#71 from tsoding/update-ubuntu-ci

    Update ubuntu CI

commit 563b2fc
Author: rexim <reximkut@gmail.com>
Date:   Thu Feb 16 15:23:18 2023 +0700

    Bump ubuntu-18.04 -> ubuntu-22.04

commit 2993903
Author: rexim <reximkut@gmail.com>
Date:   Thu Feb 16 15:22:19 2023 +0700

    Introduce fonts/ folder

commit ef77dd3
Merge: 305baf7 f62caa5
Author: Alexey Kutepov <reximkut@gmail.com>
Date:   Thu Feb 16 15:20:57 2023 +0700

    Merge pull request tsoding#48 from BillKek/20230112

    sh script to compile editor (with F3 capability) in windows executable

commit 305baf7
Merge: 8b684c9 8bf6954
Author: Alexey Kutepov <reximkut@gmail.com>
Date:   Thu Feb 16 15:11:50 2023 +0700

    Merge pull request tsoding#57 from jayhawker6/patch-1

    Fix error message typos, consistent messages

commit 8b684c9
Merge: fb33ce6 e28ae54
Author: Alexey Kutepov <reximkut@gmail.com>
Date:   Thu Feb 16 15:10:28 2023 +0700

    Merge pull request tsoding#61 from mjkloeckner/cursor_offset

    Fix cursor misaligned: add cursor offset

commit e28ae54
Merge: 5ee1d16 fb33ce6
Author: rexim <reximkut@gmail.com>
Date:   Thu Feb 16 15:09:04 2023 +0700

    Merge branch 'master' into cursor_offset

commit fb33ce6
Author: rexim <reximkut@gmail.com>
Date:   Thu Feb 16 15:03:56 2023 +0700

    Add refactoring to the kinds of PRs I do not look into right now.

commit d101988
Author: rexim <reximkut@gmail.com>
Date:   Thu Feb 16 15:01:17 2023 +0700

    Add CONTRIBUTING.md

commit 5ee1d16
Author: mjkloeckner <martin.cachari@gmail.com>
Date:   Thu Feb 9 19:59:43 2023 -0300

    Fix cursor misaligned: add cursor offset

    Adds an offset to the cursor and the selected text in editor mode, as
    well as the selected file in file browser mode.

    The offset is a constant defined in `src/common.h` that is added to the y
    coordinate of the respective cursor when being rendered.

commit 8bf6954
Author: Andrew Guernsey <75534911+jayhawker6@users.noreply.github.com>
Date:   Mon Jan 30 12:52:37 2023 -0600

    Fix error message typos

    Also made some a bit more consistent with the norm format-wise.
    (no code/logic changes, only edited some strings that get output on errors/warnings)
    (Capitalized, etc.)

commit f62caa5
Author: BillKek <51540758+BillKek@users.noreply.github.com>
Date:   Thu Jan 12 05:15:03 2023 +0300

    new! works fine !

# Conflicts:
#	build_msys2_mingw64.sh
@mjkloeckner mjkloeckner deleted the cursor_offset branch May 20, 2023 01:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants