1# TODO
2
3## Building and testing programs
4
5- [ ] Jump to error when building with `ctrl-space` and `cargo`.
6- [ ] Fix output parsing when running `go test` with ctrl-space.
7
8## Code navigation
9
10- [ ] When pressing ctrl-g or F12 and there's a filename under the cursor that exists, go to that file.
11- [ ] When pressing ctrl-g on a function that is declared in a file in the same directory, go to that file and function definition.
12- [ ] `ctrl-f` and then `return` could jump to a location at least 10 lines away that has been most visited within the last 10 minutes.
13
14## Code editing
15
16- [ ] When commenting out a block, move comment markers closer to the beginning of the text.
17- [ ] When sorting comma-separated strings that do not start with (, [ or {, make sure to keep the same trailing comma status.
18- [ ] When `}` is the last character of a file, sometimes pressing enter right before it does not work.
19- [ ] If there are four lines: not comment, comment, not comment, comment, let ctrl+/ behave differently.
20- [ ] When moving far to the right of a long line, `ctrl-k` sometimes cuts from the wrong place.
21- [ ] Indentation in Rust is sometimes wonky.
22- [ ] Fix the ctrl-\ behavior when commenting out a block at the end of a file.
23- [ ] When changing a file from tabs to spaces, or the other way around, also modify indentations after comment markers.
24- [ ] Tab in the middle of a line, especially on a `|` character, could insert spaces until the `|` aligns with the `|` above,
25      if applicable (For Markdown tables).
26- [ ] Smarter indentation for `}`. There are still a few cases where it's not too smart.
27      Perhaps use the logic for tab-indenting for when dedenting `}`?
28- [ ] If joining a line that starts with a single-line comment with a line below that also starts with a single line comment,
29      remove the extra comment marker.
30- [ ] When in "SuggestMode", typing should start filtering the list.
31
32## Debugging
33
34- [ ] Let `ctrl-space` compile C and C++ programs with debug flags if debug mode is enabled.
35- [ ] Be able to run a C program until the breakpoint and then enter gdb with the source file loaded.
36- [ ] Support Delve. Introduce a Debug mode.
37
38## Autocompletion
39
40- [ ] Let the auto-completion also look at method definitions with matching variable names (ignoring types, for now).
41- [ ] Autocompletion of filenames if the previous rune is "/" and tab is pressed.
42
43## Saving and loading
44
45- [ ] Auto-detect tabs/spaces when opening a file.
46- [ ] When editing a file that then is deleted, `ctrl-s` should maybe create the file again?
47      Or save it to `/tmp` or `~/.cache/o`? Or copy it to the clipboard?
48- [ ] Be able to open and edit large text files (60M+).
49- [ ] Should be able to open any binary file and save it again, without replacements. Add a hex edit mode.
50- [ ] Auto-detect if a loaded file uses `\t` or 1, 2, 3, 4, or 8 spaces for indentation.
51- [ ] Introduce a hexedit mode that will:
52      * Not load the entire file into memory.
53      * Display all bytes as a grid of "0xff" style fields, with the string representation to the right.
54      * This might be better solved by having a separate hex editor?
55- [ ] Be able to edit `.txt.gz` and `.1.gz` files.
56- [ ] Plugins. When there's `txt2something` and `something2txt`, o should be able to edit "something" files in general.
57      This could be used for hex editing, editing ELF files etc.
58- [ ] When the editor executable is `list`, just list the contents and exit?
59
60## Syntax highlighting
61
62- [ ] Don't let single-line comments at the end of lines disable rainbow parentheses.
63- [ ] Don't highlight /* in shell scripts like comments.
64- [ ] Also highlight hexadecimal numbers.
65- [ ] Fix syntax highlighting of `'tokens` in Clojure.
66- [ ] '://' should not be interpreted as starting a single-line comment. It's very likely to be an URL.
67- [ ] Don't highlight regular text in Nroff files.
68- [ ] `-- ` comments in Ada are not recognized.
69- [ ] Links in Markdown documents are not always recognized.
70- [ ] // within a ` block should not be recognized
71- [ ] Opening a read-only file in the Linux terminal displays different red colors when moving to the bottom.
72- [ ] Highlight this shell script line correctly: `for txt in third_party/*.txt; do`
73- [ ] Don't color `#` as a comment when editing Go code.
74- [ ] If a word over N letters is typed 1 letter differently from all the other instances in the current file: color it differently!
75- [ ] Rainbow parenthesis should be able to span multiple lines, especially for Clojure, Common Lisp, Scheme and Emacs Lisp.
76- [ ] Hash strings (like sha256 hash sums), could be colored light yellow and dark yellow for every 2 characters
77- [ ] When viewing man pages, stop the file from being possible to edit, but use the default color theme.
78- [ ] Spellcheck all comments that are in English. Highlight misspelled words. Make it possible to add/ignore words.
79- [ ] Shell scripts with if/else/endif blocks that are commented out are highlighted wrong.
80- [ ] Ignore multiline comments within multiline comments.
81- [ ] Also enable rainbow parenthesis for lines that ends with a single-line comment.
82- [ ] Syntax highlighting of `..`, `::`, `:asdfasdf:` and `^^^` in `.rst` files.
83- [ ] Highlight links in Markdown (perhaps color `[` and `]` yellow).
84
85## Documentation
86
87- [ ] Replace ` in o.1 with \b.
88
89## Cut, copy, paste and portals
90
91- [ ] Let `ctrl-t` take a line and move it through the portal?
92- [ ] GUI: Look into the clipboard functions for VTE and if they can be used for mouse copy + paste.
93- [ ] Re-enable cross-user portals?
94- [ ] Paste with middle mouse button.
95- [ ] When starting o, hash sum the clipboards it can find. When pasting, use the latest changed clipboard. If nothing changed, use the one for Wayland or X11, depending on environment variables.
96- [ ] Use `wl-copy` for copy and cut. Use the same type of implementation as for `wl-paste`.
97- [ ] Figure out why copy/paste is wonky on Wayland.
98- [ ] Check if Wayland is in use (env var) before using `wl-*`.
99- [ ] Add a command menu option to copy the entire file to the clipboard.
100- [ ] Add a command menu option to copy the build command to the clipboard.
101- [ ] If `xclip` or similar tool is not available, cut/copy/paste via a file.
102- [ ] Pressing `ctrl-v` to paste does not work across X/Wayland sessions. It would be nice to find a more general clipboard solution.
103- [ ] Let the cut/copy/paste line state be part of the editor state, because of undo.
104- [ ] Cross user portals? Possibly by using `TMPDIR/oportal.dat`.
105
106## Encoding
107
108- [ ] Detect ISO-8859-1 and convert the file to UTF-8 before opening.
109- [ ] Don't complain about the mid-dot or other unicode symbols that can be displayed in the space of 1 character. Use the unicode width module.
110- [ ] Better support for multi-byte unicode runes.
111- [ ] Open text files with Chinese/Japanese/Korean characters without breaking the text flow.
112- [ ] Quotestate Process can not recognize triple runes, like the previous previous rune is ", the previous rune is " and the current rune is ".
113      The wrong arguments are passed to the function. Figure out why.
114- [ ] If over a certain percentage of the characters are not unicode.Graphics, enter binary mode.
115
116## Command menu
117
118- [ ] Command menu option for deleting the rest of the file.
119- [ ] A menu option for recording simple vim-style keypresses, then a keypress for playing it back.
120- [ ] Add word wrap with a custom line length to the command menu.
121- [ ] Insert a custom file from the command menu.
122- [ ] Add one or more of these commands: regex search, go to definition, rename symbol, find references and disassembly.
123- [ ] Make it easy to make recordings of the editing process.
124
125## Localization
126
127- [ ] Localize all status messages and menu options.
128
129## External programs
130
131- [ ] Let `guessica` also set `pkgrel=1` if there was a new version.
132- [ ] Embed fstabfmt.
133- [ ] Extract the functionality for searching a MessagePack file to a `mpgrep` utility, that has a `-B` flag (like `grep`).
134- [ ] Draw inspiration from [kilo](https://github.com/antirez/kilo).
135
136## Unit tests
137
138- [ ] Add tests for the smart indent feature: for pressing return, tab and space, especially in relation with `{` and `}`.
139
140## Performance
141
142- [ ] Skip `os.Stat` and `Glob` if they take to long, and just open the file directly (they are needed for smart filename completion).
143- [ ] Extract the features that are used in `vt100` and create a more optimized package.
144- [ ] Reduce memory usage.
145
146## Refactoring
147
148- [ ] Replace and/or rewrite the syntax highlighting system.
149- [ ] Refactor the code to handle a line as a Line struct/object that has these markers: start of line, start of text, start of scroll view,
150      end of scroll view, end of text, one after end of text, end of line including whitespace.
151- [ ] Inherit from the Line struct (with interfaces+types+methods) by adding per-language markers: start of block, end of block,
152      indentation compared to the line above, dedentation compared to the line above
153- [ ] Or go for a server/client type of model, where the server deals with moving around in very large files, for instance.
154- [ ] Create a Go package for detecting:
155      * Language (specifically C++98 for instance)
156      * Language family (C-like, ML-like etc)
157      * tabs, spaces, indentations, mixed tabs/spaces
158      * clang style, so that the same style may be used?
159      * emacs tag
160      * vim tag
161      * what else?
162      * then translate this to a struct
163      * also think about how this can be skipped is the file is enormous and should be read in block-by-block
164- [ ] Abstract the editor, so that sending in keypresses and examining the result can be tested.
165- [ ] Rewrite `insertRune`. Improve word-wrap related functionality.
166- [ ] Introduce a type for screen coordinates, a type for screen coordinates + scroll offset, and another type for data coordinates.
167