Commit graph

9 commits

Author SHA1 Message Date
Jari Vetoniemi
ee113c4269 widgets: add CodeView widget
CodeView widget allows viewing code in a more visually pleasing manner.
It combines LineNumbers widget to provide line numbers on the side.
The CodeView widget allows you to optionally highlight a specific line
and show indentation guidelines.

It is not intended to be a fully fledged editor, but rather for showing
code snippets to a user.

While it is not a fully fledged editor, this widget's code can give you
a good starting point.
2024-05-31 18:21:54 -05:00
Jari Vetoniemi
84b4821d43 widgets: add TextView widget
The TextView widget provides a simple way to show text content in
a scrollable window.

This implementation does not offer automatic line wrapping for now.

Text content is backed by the Buffer struct. The buffer can be styled
for visually appealing and colorful content, for example to provide
a syntax highlighting.

The buffer provides a writer() interface which allows providing content
from a stream, such as logging.
2024-05-31 18:21:54 -05:00
Jari Vetoniemi
b215aec75b widgets: add LineNumbers widget
The LineNumbers widget draws vertical list of numbers.
This can be used as a line number bar for a text editor for example.
2024-05-31 18:21:54 -05:00
Jari Vetoniemi
f25b8ab421 widgets: add ScrollView widget
The ScrollView widget can be used to introduce scrollable elements into
existing widgets.

To use the ScrollView, you must use the ScrollView's writeCell and
readCell functions rather than the ones from Window.
2024-05-31 18:21:54 -05:00
00JCIV00
8d842c8b44 Added some various integer overflow protections 2024-05-12 20:25:51 -05:00
Tim Culverhouse
920e490e4c widgets: add Scrollbar widget 2024-05-06 18:54:35 -05:00
Tim Culverhouse
606272f471 widgets: add initial nvim implementation 2024-04-16 16:06:14 -08:00
00JCIV00
923c81d7d2 widgets: added table widget
- Added `Table.zig` under the `src/widgets` directory and `widgets.zig` module.
- Created the `drawTable()` function to draw a Table to the provided parent Window based on the provided ArrayList.
- Created the `TableContext` struct to manage state and attributes for the `drawTable()` function.
2024-02-26 19:21:12 -06:00
Jora Troosh
4a463cfa3a
refactor: make code more idiomatic
- Added standard .gitattributes file for Zig projects.
- Reworked build.zig a little, hopefully it's a bit clearer. Also, now zig build will run all steps.
- outer: while in examples was redundant since there's only one loop to break from. switch expressions don't allow breaking from them, so breaking is only for loops, i.e. while and for.
- When returning a struct instance from a function, the compiler infers the return type from function signature, so instead of return MyType{...}; , it's more idiomatic to write return .{...};.
- Logging adds a new line by default, so you don't usually need to write \n like here: log.debug("event: {}\r\n", .{event});.
2024-02-11 12:59:33 -06:00