Giter Club home page Giter Club logo

zep's People

Contributors

abelliqueux avatar allcontributors[bot] avatar cmaughan avatar dontlaugh avatar gitter-badger avatar green-sky avatar jacobfriedman avatar jessp01 avatar mogiwar avatar nicolasnoble avatar redstrate avatar samhocevar avatar totalgee avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

zep's Issues

Multiple changes / feedback

I've recently integrated Zep into my project PCSX-Redux, replacing ImGuiColorTextEdit out. While doing so, I've done numerous little fixes and changes to Zep. I could create one issue / pull request per change I've done, but I'd like to avoid bombarding you with issues and PRs. But if you'd rather me doing so, please let me know and I'll gladly extract my changes in individual Pull Requests / issues.

My current list of changes are in https://github.com/nicolasnoble/zep/commits/40ff9f8c0fd0a159249c4f9d6e0ebcdee81dce1e, and here's a small list of issues / enhancements I've done:

General comments

ImGui integration

The current ImGui input code assumes:

  • no other window will try to read keyboard input (and so ignores widget focus)
  • SDL and "something else?" for input, which doesn't work for all ImGui backends, such as GLFW.

As a result, when using GLFW as the backend, typing the key a on the keyboard (which is ascii 0x41 for glfw) will result in sending a function key instead:

#define ZEP_KEY_F8 0x41 // Keyboard F8

I've created my own ZepEditor_imgui class, but my opinion is that the code should probably offer one Editor class per possible backend, like SDL, GLFW, etc.

https://github.com/grumpycoders/pcsx-redux/blob/4e3aeb5a0bd31cb1bbaa02c7f1be34177649a92a/src/gui/widgets/zep.cc

(additionally, this new code uses ImGui::IsWindowFocused to discard keyboard input that aren't directed towards the Zep widget)

Lua parser

The syntax.cpp file references lua keywords, but doesn't register any parser for it. The Lua syntax is significantly different from base C that it wouldn't work properly anyway, so I wrote a Lua parser that seems somewhat correct, or at least, good enough:

https://github.com/nicolasnoble/pcsx-redux/blob/4e3aeb5a0bd31cb1bbaa02c7f1be34177649a92a/src/gui/widgets/zep-lua.cc

Fixes

DPI scaling is currently invalid

The current code assumes a single DPI scale, that never changes. In reality, this doesn't work, because users may change DPI on their current screen, or even have multiple monitors, all with different DPIs. As a result, DPI-aware code needs to be able to react to DPI change events. This is in essence what I've done here: nicolasnoble@97b4365

The code probably should use a signal to be broadcasted, in order to fully invalidate fonts and other painting, but I wasn't sure.

This is likely an API breaking change in its current state, due to the DPI scale being removed from the constructor.

(additionally, there is a dead, never used variable here:)

NVec2f m_pixelScale = NVec2f(1.0f);

Line number in Standard Mode

The current code has a DisplayMode enum that's never assigned to any value:

DisplayMode m_displayMode = DisplayMode::Vim;

As a result, this check is always true, regardless of the editor mode:

if (m_displayMode == DisplayMode::Vim && m_pBuffer->GetMode()->GetCursorType() != CursorType::None)

I've fixed this by using a new virtual on the mode: nicolasnoble@249dafe

gap_buffer.h doesn't compile

More specifically, this part of the template:

friend const_iterator operator+(size_type lhs, const const_iterator& rhs) { return const_iterator(lhs.buffer, lhs + rhs.p); }

references rhs.buffer where rhs is but a size integral.

Fix: nicolasnoble@a38f2f7

Paste isn't using the system's clipboard

All the paste commands use the " register for the slice of text to insert, but only registers * and + are assigned from the system's clipboard. Fix: nicolasnoble@68fb6ad

Improvements

Syntax parser

I've overhauled a bit the base syntax parser to handle numbers and comments a bit better. I'm still not totally happy with it, but I think it's a general improvement over the base code. The new file is at https://github.com/nicolasnoble/zep/blob/main/src/syntax.cpp

I have no idea how this fares on the Lisp mode however.

Mouse clicks to move the cursor

As a simple Quality of Life, I've added a mouse cursor and the ability to move the keyboard cursor to it: nicolasnoble@fe2a6a4

The feature is probably awkward as it doesn't actually send a command to move the cursor, which doesn't necessarily update the buffer status properly. Also affects all modes, not just standard. Mouse dragging to select would be a plus.

I think I'd rather move this to commands, using a new encoding for mouse events, similar to the <C-v> pattern.

Standard mode selection deletion

This feels a lot more natural than only having Ctrl-x working: nicolasnoble@03b1598

Ctrl-a "select all" in Standard mode

This also feels a lot more natural: nicolasnoble@40ff9f8

Make markers adjust with edits

Describe the bug
Range marks should move around when the user edits text before/after/inside.

To Reproduce
:ZTestMarkers
Insert text before or after.

Expected behavior
Mark should stay where it is.

Simple ImGUI example

It seems it should be easier to integrate this great editor into an ImGUI project.

  • There is https://github.com/cmaughan/imgui/blob/b562cfeb14060a6b3b0c8189c3e16ea1ffa01070/imgui_demo.cpp#L219 Which is a much more simple integration example then the imgui demo. However it is outdated as ZepEditor expects more arguments for example.

  • There is a define ZEP_SINGLE_HEADER_BUILD which is there for convenience I guess. However it requires a config_app.h (single line file on my system?). Could be very handy to use without building a lib first.

  • The provided ImGui demo has quite some dependencies which (I'm not sure) are not really needed.

  • From what I read in the code the imgui demo uses freetype font rendering, I guess that's optional?

Perhaps the example can be updated as it seems more straightforward?

src/line_widgets.cpp not compiled in single header mode

Describe the bug
src/line_widgets.cpp not compiled in single header mode.
linker throws errors

To Reproduce
Steps to reproduce the behavior:

make cpp file with and includes correct

#include <imgui.h>
#define ZEP_SINGLE_HEADER_BUILD
#include <zep.h>

compile

Expected behavior
add #include "../src/line_widgets.cpp" to zep.h
and it links just fine

Desktop (please complete the following information):

  • OS: Windows 10, clang 9.0.0
  • Version [e.g. 22]

Additional context
Haven't tried using it yet, just getting it integrated atm

A method to advertise font changes to ZepWindow?

Is your feature request related to a problem? Please describe.
When the font changes, horizontal character spacing is not recomputed because m_charCacheDirty is never set to true again. Vertical spacing and about everything else seems OK.

Describe the solution you'd like
Maybe just a method in ZepWindow that sets m_charCacheDirty to true?

Additional context
Initial rendering in ImGui:
image
After loading a larger or a smaller font:
image
image

Support Tab Key as tabs instead of spaces.

Describe the solution you'd like
Want to support tabs natively and not convert them to spaces

Additional context
This is a feature request. It needs to be evaluated for time.

Remove SDL macros from keymaps binding

Describe the bug
It should not be necessary to use SDL to build the IMGUI component.

To Reproduce
Build without SDL

Expected behavior
No compile issues

Add Vertical Scroll Bar, mainly for Standard mode

Is your feature request related to a problem? Please describe.
Unenlightened users will probably need a vertical scroll bar.

Describe the solution you'd like
Add a scroller, and maybe a horizontal one for unwrapped modes

Describe alternatives you've considered
In Vim, users mostly move using keyboard. But a scrollbar is useful.

Additional context
It's not so easy to add a native scrollbar, so a drawn one will have to be added.

Extend marker system to support tooltips

Is your feature request related to a problem? Please describe.
Need the ability to show tooltips for a given range of characters

Describe the solution you'd like
When the user creates a marker region, the associated description text will popup as a marker when the mouse moves over it. If something else happens, like a keypress, the tooltip will disappear and not reappear until the mouse moves away. The tooltip should have a short delay before appearing.

Assigned to myself, since I know how to do this quickly.

Suggestion to use std::unordered set for syntax highlighting

The syntax providers use std::set instead of std::unordered_set, making lookups O(log n) rather than O(1). I have not found an obvious reason for this, but changing it would mean breaking existing code that uses ZepSyntax::ZepSyntax, so I’d like to put this up for discussion.

Support timer for similar keyboard chord distinction.

Is your feature request related to a problem? Please describe.
Sometimes we need to distinguish key chords based on timing; for example - CTRL+K is different to CTRL+KO - if there is a long enough pause after the K, then CTRL+K is executed. Or if CTRL+K is pressed then a key that isn't O.

Describe the solution you'd like
Add a key mapping timer to disambiguate the keystrokes. This might be the time to think about a remapping file too; though I am currently not enthused about making keymapping an option.

Describe alternatives you've considered
Currently we require a unique mapping. Currently CTRL+IO is alternative file, but I prefer KO.

Occasionally vertical splits will become horizontal

Describe the bug
The layout code doesn't do the right thing when you add a hsplit to a vsplitted parent

To Reproduce
Steps to reproduce the behavior:
Before loading any files:
:vsplit, CTRL+P
If you first load a file and split, this doesn't happen!

Expected behavior
A v:split on top of a window at the bottom

Add more Vim keystrokes

In order of preference/usefulness/ease of implementation:

  • r 'replace' mode. I use this a lot for single character replacement
  • ct, dt 'change to'/'delete to'. Change everything up to a character
  • ci 'change in' ()[], etc.
  • / search
  • :%s///g search and replace (harder)
  • viw Select inner word. This may be broken rather than unimplemented!
  • % find matching delimiter

Config.bat not found for mutils

Describe the bug
Github's readme says that when installing for windows, should use "config.bat". Looks like that's invalid.. maybe should be "config_all.bat"?

To Reproduce
Steps to reproduce the behavior:
Follow these steps on Windows: https://github.com/Rezonality/zep#windows
This step doesn't work:
config.bat

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Version [e.g. 22]

Additional context
I suspect should be the config_all.bat ?

Address FileSystem issues, optionally compile without

Is your feature request related to a problem? Please describe.
Filewatcher doesn't work on all platforms.
Sometimes the client app will want to implement its own filing system.

Zep currently uses from c++14. It's supported everywhere except Mac. On Mac, zep implements the barebones of filesystem to support it (in mfilesystem.cpp).
Filewatcher works on Mac/Linux/Windows, but probably not IOS or Android.

Describe the solution you'd like
Optionally disable the file watcher in the compilation settings.
Add a FileSystem manager which abstracts the local file system.

ZepSyntax constructor calls virtual function

Describe the bug
ZepSyntax::ZepSyntax calls QueueUpdateSyntax, which in turn will call UpdateSyntax synchronously when no threads are available. This is illegal because UpdateSyntax is a virtual function and the vtable is not ready at this point.

To Reproduce

  1. Create an editor with ZepEditorFlags::DisableThreads.
  2. Open any file that has syntax support; the call order will be: ZepBuffer::Load()ZepBuffer::SetText()ZepEditor::SetBufferSyntax()ZepSyntax::ZepSyntax()

CMake Error at extensions/CMakeLists.txt:7 (find_package): By not providing "FindSDL2.cmake"

Describe the bug
While building on windows using :
cmake -G "Visual Studio 16 2019" -A x64 -DZEP_FEATURE_CPP_FILE_SYSTEM=1 -DBUILD_IMGUI=0 -DBUILD_TESTS=0 -DBUILD_DEMOS=0 ..
This error pops up.
To Reproduce
Steps to reproduce the behavior:

  1. Clone the repo
  2. On the command line, run the above command
  3. See the error

Screenshots

F:\Dropbox\Tech\production\ppc\zep\build>cmake -G "Visual Studio 16 2019" -A x64 -DZEP_FEATURE_CPP_FILE_SYSTEM=1 -DBUILD_IMGUI=0 -DBUILD_TESTS=0 -DBUILD_DEMOS=0 ..
-- CMakeLists: Zep
-- Build Type:
-- Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.18363.
-- The CXX compiler identification is MSVC 19.27.29111.0
-- The C compiler identification is MSVC 19.27.29111.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.27.29110/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.27.29110/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- System: Windows-10.0.18363
-- Compiler: MSVC
-- Flags: /DWIN32 /D_WINDOWS /W4 /WX /GR /EHsc /MP /Zm127 /Zp16 /D_SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING /D_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS /D_SCL_SECURE_NO_WARNINGS=1 /D_CRT_NONSTDC_NO_WARNINGS=1 /D_CRT_SECUR
E_NO_WARNINGS=1
-- Arch:
-- TARGET_PC
CMake Error at extensions/CMakeLists.txt:7 (find_package):
  By not providing "FindSDL2.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "SDL2", but
  CMake did not find one.

  Could not find a package configuration file provided by "SDL2" with any of
  the following names:

    SDL2Config.cmake
    sdl2-config.cmake

  Add the installation prefix of "SDL2" to CMAKE_PREFIX_PATH or set
  "SDL2_DIR" to a directory containing one of the above files.  If "SDL2"
  provides a separate development package or SDK, be sure it has been
  installed.


-- Configuring incomplete, errors occurred!

Desktop (please complete the following information):

  • OS: Win 10, VC 19

cmake errors + fix?

Just trying out the library on a Linux system gives some errors. Running this on Debian bullseye with cmake 3.18.4:

$ cmake ..
-- CMakeLists: Zep
CMake Error at /usr/share/cmake-3.18/Modules/CMakeDetermineSystem.cmake:99 (message):
  Could not find toolchain file:
  /home/arnaud/src/zep/../vcpkg/scripts/buildsystems/vcpkg.cmake
Call Stack (most recent call first):
  CMakeLists.txt:32 (project)


CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!

Not sure why it's looking for vcpkg? Is this really needed?

Running with cmake .. -DBUILD_QT=OFF -DBUILD_DEMOS=OFF gives:

CMake Error at CMakeLists.txt:79 (configure_package_config_file):
  Unknown CMake command "configure_package_config_file".

So I guess CMakeLists.txt needs

include(CMakePackageConfigHelpers)

which then succeeds. 👍

Question: is mouse selection and are scrollbars supported?

Hi, I am eyeing Zep as a nicer Scintilla alternative for using in an imgui environment. From looking at the video and screenshots, I can't figure out if scrollbars are supported. Other thing I can't figure out is if using the mouse to select text or set the position of the caret is supported.

Using Zep with "international" keyboard (key code remapping?)

Describe the bug
I'm trying to use Zep with ImGui, inside the Cinder framework (which has its own keymapping but internally uses GLFW). My keyboard is Spanish, which means that some keys (notably {}[]|@#~\) are accessed differently than on an standard US keyboard. On a Spanish keyboard, these require pressing the AltGr key before pressing another key to get the desired character (e.g. bracket/brace). I've managed to handle these keys, by writing a keypress handler (in Cinder) that remaps/translates input keyboard events into simpler events for ImGui. For example, pressing AltGr+´ should give me an open brace {, but in Zep it thinks control was pressed, since AltGr behaves like Ctrl+Alt. So I remapped things in this case:

    auto& io = ImGui::GetIO();
    io.AddInputCharacter('{');
    io.KeyCtrl = io.KeyAlt = false;

And that seems to work...in my program, in the Zep editor, I get a { inserted (if I don't modify KeyCtrl, then I get a <C+{> inserted). But I'm still having problems with other keys (ones that don't require AltGr), such as + or ^. These don't require modifier keys but are different key codes than a US keyboard.

I notice you have special handling for SDL (ref: ZEP_USE_SDK in editor_imgui.h) and I'm wondering if I might need something similar to handle my (Cinder/GLFW) codes. I'm looking through the code but am not very familiar with it yet...can you give me any pointers on how I should be approaching this? i.e. how to fix it in the "correct" way? Thanks!

Desktop (please complete the following information):

  • OS: Windows 10 Pro
  • Visual Studio 2019 (C++17)

Key repeats get stuck when holding down navigation keys on RedStone 5.

Describe the bug
Holding down 'j' and then letting go will sometimes skip over several lines after the fact. This seems to be a new bug on Windows RS5, and probably an interaction with SDL, since it doesn't happen on the Qt build.

Desktop (please complete the following information):

  • OS: Windows
  • Version RS5

Support Regex in syntax highlighter

Is your feature request related to a problem? Please describe.
More control required over how the syntax highlighter works

Describe the solution you'd like
The ability to use regex to specify how the syntax highlighting works.

Describe alternatives you've considered
Add more features to the existing engine.

Additional context
Need to evaluate how hard this is to do, and what the alternatives are. Would probably need to fix the threading too.

Potential problems with Zep::ZepTheme::GetColor() API change

Describe the bug
When integrating a more recent version of Zep, I was hit by a bug where my whole editor went black. This did not happen when compiling in debug mode, which made it a bit tricky to track down. I finally realised it was because Zep::ZepTheme::GetColor now returned a Zep::NVec4f const & (as opposed to a Zep::NVec4f previously), so when overriding that method I had to make sure I did not return a reference to a temporary because the compiler was (rightfully) assuming I did not care about the returned value.

I studied bf53e9c and could not understand a reason behind returning a reference. From what I found so far, the returned value is always eventually copied to a Zep::Nvec4f.

This is of course a very common mistake that every C++ programmer should avoid, but it is easily overlooked and I realise that the copiler did not warn me about it.

Also there is currently a real problem in ZepTheme due to that: since SetLightTheme() allocates more colors than SetDarkTheme(), any value returned by GetColor may be invalidated by a call to SetLightTheme().

My personal issue is solved but I’m still suggesting reverting the API change to avoid surprises for other users.

Line wrapping and step down problem

Describe the bug
With word wrap on, sometimes stepping down with 'j' at the end of a wrapped line will not step to the next line and get 'stuck'

To Reproduce
Create a long line and an empty line after it, make the editor small so that the text wraps, and use J to step down.

utf8::unchecked::iterator should not derive from std::iterator

Describe the bug
When compiling on VS2019 (with C++17), there are warnings from the inheritance of std::iterator by utf8::unchecked::iterator, with the following message:

1>C:\Users\...\zep\include\zep\mcommon\utf8\unchecked.h(220,40): warning C4996: std::iterator<std::bidirectional_iterator_tag,utf8::uint32_t,ptrdiff_t,utf8::uint32_t *,utf8::uint32_t &>: warning STL4015: The std::iterator class template (used as a base class to provide typedefs) is deprecated in C++17. (The <iterator> header is NOT deprecated.) The C++ Standard has never required user-defined iterators to derive from std::iterator. To fix this warning, stop deriving from std::iterator and start providing publicly accessible typedefs named iterator_category, value_type, difference_type, pointer, and reference. Note that value_type is required to be non-const, even for constant iterators. You can define _SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning. (compiling source file ..\zep\src\buffer.cpp)

To Reproduce
Steps to reproduce the behavior:

  1. Build a project using Zep under VS2019 (compiling in C++17 mode).
  2. See warnings (not hugely serious, but should be cleaned up at some point).

Expected behavior
No warnings.

Desktop (please complete the following information):

  • OS: Windows 10 Pro
  • Version 10.0.19043
  • VS2019 version 16.8.3

Installing on Windows, can't find "toolchain file"

Describe the bug
Installing Zep on windows following the steps found on front page of git. Think that Visual studio is being referenced by relative rather than absolute path.

To Reproduce
git clone https://github.com/Rezonality/zep
cd zep
config.bat

Expected behavior
zep to be installed

*Terminal Output
C:\Tools\VIM_Terminal\mutils\zep>config.bat

C:\Tools\VIM_Terminal\mutils\zep>set CURRENT_DIR=C:\Tools\VIM_Terminal\mutils\zep

C:\Tools\VIM_Terminal\mutils\zep>mkdir build 1>nul

C:\Tools\VIM_Terminal\mutils\zep>cd build

C:\Tools\VIM_Terminal\mutils\zep\build>cmake -G "Visual Studio 16 2019" -A x64 -DZEP_FEATURE_CPP_FILE_SYSTEM=1 ..
-- CMakeLists: Zep
CMake Error at C:/Program Files/CMake/share/cmake-3.19/Modules/CMakeDetermineSystem.cmake:110 (message):
Could not find toolchain file:
C:/Tools/VIM_Terminal/mutils/zep/../vcpkg/scripts/buildsystems/vcpkg.cmake
Call Stack (most recent call first):
CMakeLists.txt:32 (project)

-- Configuring incomplete, errors occurred!

Desktop (please complete the following information):

  • OS: Windows
  • Version 10

Additional context
Used config.bat, not config_all.bat
Installed mutils first
Visual Studio 2019 is installed

Fix column up down with variable width fonts

Is your feature request related to a problem? Please describe.
Fix column up down with variable width fonts

Describe the solution you'd like
When using variable width fonts, column up down, and potentially other things is broken.

Need to research how hard this is to fix.

ImGui demo is sluggish due to battery saver

Describe the bug
The 10-millisecond sleep in demo_imgui/main.cpp appears to cause typed-in keys to be displayed upon key release events rather than key press events, giving the impression that the editor is slow. Removing that code makes everything feel fast again.

To Reproduce
Steps to reproduce the behavior:

  1. Build the project
  2. Run build/ZepDemo
  3. Type in some text or use the arrow keys to navigate

Desktop (please complete the following information):

  • OS: Debian GNU/Linux
  • Version unstable

Issue: this code is...

....AWESOME!!!!

Thank you so much for releasing this. I was about to sit down and start exactly this kind of project but you already nailed it. I freaking love you, and IMGUI, and all the other generous giants who's shoulders us little people get to stand on.

I had a problem with my conscience. Maybe not the most appropriate thread but hopefully you are a good sport.

Thanks cmaughan!

I hope to share the "thing I really wanted to make" which this will let me do straight away. But for now: You are the pho-king-meta-bomb-diggity menu item #5, with an extra helping of w00t-sauce!

Drag-select text

Allow the user to drag-select a region of text. Mostly for Standard Mode.

Add more Standard mode keystrokes

Is your feature request related to a problem? Please describe.
Standard mode has the usual keystrokes for notepad, but there are more that would probably be useful.

Describe the solution you'd like
As a first step, a quick review of the common keystrokes in notepad/wordpad/work, for example might throw up some obvious ones we could add

Feature suggestion: Offer a third release/build option with split header and cpp file.

Is your feature request related to a problem? Please describe.
The readme points Zep as a single header increases compile time.

Describe the solution you'd like
Instead of offering a single header, offer a single split, header and cpp file.

This tool can produce this split offering: github.com/shrpnsld/amalgamate.

Describe alternatives you've considered
I tried to find the script that generated the single header for zep but couldn't find.

Additional context
I really like this and plan to use it. Ah, I noticed this project has no release, so I couldn't actually verify the claims on the README on build being increased to see how long it takes (like, enough to bother to do the split).

C++17/20 compatibility?

I am opening this issue to gauge the state of Zep's compatibility with C++17/20 and starting discussion about it.

I was trying to integrate Zep, but it looks like it's sort of stuck in a pre-C++-17 compilation environment.

I was trying to integrate it with Visual Studio 2019 in a C++20 project, and it failed very quickly on https://github.com/Rezonality/zep/blob/master/include/zep/mcommon/utf8/unchecked.h#L220 and https://github.com/Rezonality/zep/blob/master/include/zep/mcommon/signals.h#L296, with the latter being that std::result_of which was deprecated in C++17 has been completely removed in C++20: https://en.cppreference.com/w/cpp/types/result_of, and the former being basically https://www.fluentcpp.com/2018/05/08/std-iterator-deprecated/

These were the top two failures, and I'm not sure what else is going to fail after this.

What's the migration path looking like for moving past C++14 in Zep? Is there a roadmap for it? Should I try cleaning this up, if there's a desire for it?

Thanks!

How to customize the theme colours and background

Discussed in #80

Originally posted by totalgee February 25, 2022

  1. Is there a way to customize the theme without changing the Zep library itself? I'd like to modify the colours for keywords or identifiers (taking one of the default themes and tweaking a few values).

Questions about future plans

Hi, I plan to work on a few features / changes and I’d like to know your opinion about which ones would have a chance to land in your project, and which ones I should keep in my fork because they go beyond the scope you have in mind.

  • syntax support: as you may have seen, ImGuiColorTextEdit gives more control to the user, for instance with regexes to define their own syntax colouring; are you planning to go this route, or do you wish to keep this feature minimal?
  • tooltips: I would like to let my users hover on a function name (maybe recognised by the syntax driver) and see a popup with its documentation or other notes
  • option to compile without the file watcher mechanism (it pulls quite a lot of system-specific dependencies, as well as the experimental libstdc++fs) or without file support altogether (the host application should be able to decide whether loading/saving is allowed, and what to do with the editor buffer)
  • option to compile on platforms without threads (right now the ThreadPool constructor just throws on these platforms)
  • option to compile without SDL (editor_imgui.cpp still uses it for some scancodes macros)
  • real tab support (or at least an option to not replace them with spaces)
  • make up/down arrows move according to the physical cursor location rather than the column number (causes weird effects when using a variable-width font)

Insert mode MotionRight can't reach end of line?

Describe the bug

can't move cursor to end of line in insert mode, cursor sticks prior to end of line instead of moving to end of line

To Reproduce

enter insert mode, enter text 1234. press escape to enter normal mode. move cursor left and right. It works as expected; i.e. 12[3]4 when moving left, 123[4] when moving right. Pressing right again does nothing.

enter insert mode with cursor on 4. Per vim usual the result is 123|4. Cursor left is 12|34, cursor right is 123|4. A further cursor right stays at 123|4

Expected behavior

a further cursor right in insert mode yields 1234| further right arrows stay at the end of the line

If I make the following patch, insert mode allows the cursor to move to the end of the line, but also allows the cursor to wrap to the next line, so not the same as vim. I was wondering if this rings any bells? I'm not sure what I might be doing wrong. I tried other solutions, but they had side effects, like allowing the cursor in normal mode to go beyond the end of the line. I started to think maybe there needs to be MotionInsertRight to exactly implement a vim behavior; at which point I thought I must be doing something wrong...

--- a/src/mode.cpp
+++ b/src/mode.cpp
@@ -2491,10 +2491,10 @@ void ZepMode::AddNavigationKeyMaps(bool allowInVisualMode)
     keymap_add(navigationMaps, { "<C-h>" }, id_MotionLeftSplit);

     // Arrows always navigate in insert mode
-    keymap_add({ &m_insertMap }, { "<Down>" }, id_MotionDown);
-    keymap_add({ &m_insertMap }, { "<Up>" }, id_MotionUp);
-    keymap_add({ &m_insertMap }, { "<Right>" }, id_MotionRight);
-    keymap_add({ &m_insertMap }, { "<Left>" }, id_MotionLeft);
+    keymap_add({ &m_insertMap }, { "<Down>" }, id_MotionStandardDown);
+    keymap_add({ &m_insertMap }, { "<Up>" }, id_MotionStandardUp);
+    keymap_add({ &m_insertMap }, { "<Right>" }, id_MotionStandardRight);
+    keymap_add({ &m_insertMap }, { "<Left>" }, id_MotionStandardLeft);
 }

 void ZepMode::AddSearchKeyMaps()

My key handler is very straightforward, basically lifted straight from the sample, I assume I'm using it correctly? I'm not sure where else to look for a bug in my code. I have verified that zep is definitely in insert mode, and it's definitely invoking MotionRight, so I'm feeling a bit stuck at the moment. MotionStandardRight lets me get to the end of the line for now, but I'd like to know where I've gone off the rails...

    // returns true if the event was consumed
    bool HandleKeyInput(const ZepBuffer& buffer,
        uint32_t key, bool ctrl, bool shift)
    {
        bool handled = false;
        uint32_t mod = (ctrl ? Zep::ModifierKey::Ctrl : 0) |
                       (shift ? Zep::ModifierKey::Shift : 0);

        switch (key)
        {
        case Zep::ExtKeys::TAB:
        case Zep::ExtKeys::ESCAPE:
        case Zep::ExtKeys::RETURN:
        case Zep::ExtKeys::DEL:
        case Zep::ExtKeys::HOME:
        case Zep::ExtKeys::END:
        case Zep::ExtKeys::BACKSPACE:
        case Zep::ExtKeys::RIGHT:
        case Zep::ExtKeys::LEFT:
        case Zep::ExtKeys::UP:
        case Zep::ExtKeys::DOWN:
        case Zep::ExtKeys::PAGEDOWN:
        case Zep::ExtKeys::PAGEUP:
            buffer.GetMode()->AddKeyPress(key, mod);
            return true;
        }

        if (ctrl)
        {
            if (key == '1')
            {
                SetGlobalMode(ZepMode_Standard::StaticName());
                handled = true;
            }
            else if (key == '2')
            {
                SetGlobalMode(ZepMode_Vim::StaticName());
                handled = true;
            }
            else if (key >= 'A' && key <= 'Z')
            {
                buffer.GetMode()->AddKeyPress(key - 'A' + 'a', mod);
                handled = true;
            }
            else if (key == ' ')
            {
                buffer.GetMode()->AddKeyPress(' ', mod);
                handled = true;
            }
        }

        if (!handled)
        {
            handled = true;
            if (key != '\r')
            {
                buffer.GetMode()->AddKeyPress(key, mod);
            }
        }

        return handled;
    }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.