Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
b81c630
refactor cursor movement for comsistency
Ttibsi Dec 4, 2025
20c98ab
adjust tests for new cursor movement
Ttibsi Dec 4, 2025
4b92315
Update integration tests
Ttibsi Dec 8, 2025
5db91de
disable ctrl+backspace in write mode
Ttibsi Nov 7, 2025
a6b0eac
add an integration test
Ttibsi Nov 7, 2025
2dda2c4
wqa command
Ttibsi Nov 22, 2025
ab8d6d9
docs
Ttibsi Nov 22, 2025
ffaf0fd
Restore cursor after escaping CMD mode
Ttibsi Dec 9, 2025
b6c7895
Update changelog
Ttibsi Dec 9, 2025
c87f227
Resize on SIGCONT
Ttibsi Dec 18, 2025
a464622
Add a new type hint
Ttibsi Dec 18, 2025
32c0b18
Changelog update
Ttibsi Dec 18, 2025
ce758e4
Initial setup
Ttibsi Dec 9, 2025
3d7050a
we can now move a single character
Ttibsi Dec 9, 2025
57c5a80
an initial integration test
Ttibsi Dec 9, 2025
df13704
begin calculations on drawing
Ttibsi Dec 9, 2025
587f830
Add new TODO
Ttibsi Dec 10, 2025
31d6131
Move cursor right to scroll now
Ttibsi Dec 10, 2025
51f9c27
scroll left seems to work now
Ttibsi Dec 10, 2025
a3119f2
Move right and redraw the current line as well
Ttibsi Dec 10, 2025
8d7fddf
Integration tests (failing) for horizontal scrolling
Ttibsi Dec 16, 2025
05c725f
pre-commit add autopep8
Ttibsi Dec 16, 2025
33b2485
Pass horizontal movement tests
Ttibsi Dec 16, 2025
e084169
reorder pre-commit hooks
Ttibsi Dec 16, 2025
a1e7278
move up down test
Ttibsi Dec 16, 2025
cf1c10c
modifying text and redrawing tests
Ttibsi Dec 16, 2025
390637a
finalise movement tests
Ttibsi Dec 16, 2025
3061e55
Update unit tests
Ttibsi Dec 17, 2025
fa7ffff
resolve warnings
Ttibsi Dec 17, 2025
65f4fc1
Remove completed TODOs
Ttibsi Dec 17, 2025
deffa75
autopep8
Ttibsi Dec 17, 2025
b556a79
Review the rest of the integration tests
Ttibsi Dec 17, 2025
4de19b3
Update for tests
Ttibsi Dec 24, 2025
66149cd
Resolve error
Ttibsi Dec 24, 2025
1abc374
spdlog head
Ttibsi Dec 31, 2025
eedb93f
integration test for backspace across a tab
Ttibsi Nov 4, 2025
f7592e5
unit test for cursor backspace across a tab space
Ttibsi Nov 4, 2025
efd27dc
convert Redraw into a struct
Ttibsi Nov 4, 2025
438fe30
backspace can now move a whole tab width
Ttibsi Nov 4, 2025
7fb813f
changelog
Ttibsi Nov 4, 2025
e4d74ef
deleting lines moves the cursor in a reasonable direction
Ttibsi Nov 11, 2025
a7a64f8
update milestones
Ttibsi Jan 6, 2026
7ea95a3
update milestones
Ttibsi Jan 7, 2026
aa1a7cd
unit tests for handling passing a filename in the command bar
Ttibsi Nov 19, 2025
5545c1e
Add integration tests
Ttibsi Nov 19, 2025
95ae867
Handle saving to a new file from command mode
Ttibsi Nov 19, 2025
7677845
update docs
Ttibsi Nov 19, 2025
a9c7c46
empty
Ttibsi Nov 19, 2025
c11e613
update tests
Ttibsi Jan 5, 2026
7b0fc0b
initial tests
Ttibsi Nov 28, 2025
a61f972
Handle e key
Ttibsi Nov 28, 2025
4d72bae
Add numbers to 'is_letter'
Ttibsi Nov 28, 2025
9bb44ef
implement unit tests
Ttibsi Jan 7, 2026
38d2529
Update docs
Ttibsi Jan 7, 2026
753b474
Display the cursor position in red when over a predefined line length
Ttibsi Nov 14, 2025
223938a
test for rendering cursor coords
Ttibsi Nov 14, 2025
f36ba7d
decrease tab bar flicker
Ttibsi Nov 13, 2025
693b88c
update clang-format
Ttibsi Jan 13, 2026
d190de7
pre-commit autoupdate
Ttibsi Jan 13, 2026
d4737af
Change return type in template
Ttibsi Jan 15, 2026
c22a1da
minor tweaks to tests
Ttibsi Jan 15, 2026
01ef71b
pre-commit refactor
Ttibsi Jan 15, 2026
da5a1bd
use gcc in CI as well
Ttibsi Jan 13, 2026
f89772d
pre-commit and clean up cmake
Ttibsi Jan 13, 2026
46511f3
add apt install gcc for newer version
Ttibsi Jan 13, 2026
6cad8c5
add logic to install gcc
Ttibsi Jan 13, 2026
d88db3f
Try with g++-14
Ttibsi Jan 15, 2026
653e5d2
refactor cursor movement for consistency
Ttibsi Dec 4, 2025
9d3ff92
adjust tests for new cursor movement
Ttibsi Dec 4, 2025
35b9509
resolve issues with unit tests
Ttibsi Feb 12, 2026
55a725c
fixes after rebasing
Ttibsi Feb 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .clang-format
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
---
BasedOnStyle: Chromium
AlignAfterOpenBracket: AlwaysBreak
AllowShortBlocksOnASingleLine: "Always"
AllowShortIfStatementsOnASingleLine: WithoutElse
BasedOnStyle: Chromium
ColumnLimit: '100'
ConstructorInitializerAllOnOneLineOrOnePerLine: 'true'
Cpp11BracedListStyle: 'true'
Expand Down
18 changes: 13 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,30 @@ jobs:
- run: sudo apt-get install ninja-build clang-19
- run: ./run.py
env:
IRIS_CXX_COMPILER: clang++-19
CXX: clang++-19
- uses: pre-commit/action@v3.0.0
unit_tests:
gcc_unit_tests:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- run: sudo apt-get install ninja-build g++-14
- run: ./run.py test
env:
CXX: /usr/bin/g++-14
clang_unit_tests:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- run: sudo apt-get install clang-19
- run: ./run.py test
env:
IRIS_CXX_COMPILER: clang++-19
CXX: clang++-19
integration_tests:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- run: sudo apt-get install clang-19
- run: sudo apt-get install ninja-build g++-14
- run: ./run.py test -I
env:
CXX: /usr/bin/g++-14
PYTEST_ADDOPTS: "--color=yes"
IRIS_CXX_COMPILER: clang++-19
15 changes: 12 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ repos:
exclude: "tests/fixture/no_newline_file.txt"
- id: trailing-whitespace
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v21.1.2
rev: v21.1.8
hooks:
- id: clang-format
exclude: ".json"
Expand All @@ -31,19 +31,28 @@ repos:
rev: v4.0.0
hooks:
- id: add-trailing-comma
- repo: https://github.com/hhatto/autopep8
rev: v2.3.2
hooks:
- id: autopep8
args: [--in-place, --max-line-length=100]
- repo: https://github.com/PyCQA/flake8
rev: 7.3.0
hooks:
- id: flake8
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.18.2
rev: v1.19.1
hooks:
- id: mypy
- repo: https://github.com/rhysd/actionlint
rev: v1.7.8
rev: v1.7.10
hooks:
- id: actionlint
- repo: https://github.com/sco1/brie-commit
rev: v1.1.0
hooks:
- id: brie-commit
- repo: https://github.com/GideonBear/pre-comet
rev: v1.0.0
hooks:
- id: pre-comet
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,20 @@
* Ensure the block cursor is restored when iris is closed
* Refactored how `;s` works for find and replace
* Added `;f` command to find a given string further on in the buffer
* Use `wqa` to save and close all files
* Iris now handles horizontal scrolling when a line is longer than the screen
* Pressing backspace at the end of a tab width's worth of whitespace now
moves back that amount of space
* Allow for specifying file to save to from command bar
* `e` key now moves cursor to end of the current word

* Resolved issue with iris crashing after opening an existing file with 0 bytes
* Resolved issue where filename isn't centered in the status bar
* Resolved issue with `ctrl+bspace` inserting an `h`
* Resolved issue where the cursor would stay in the command bar when escaping
out of it
* Resolved issue where iris wouldn't resize after SIGCONT if the terminal had
been resized while backgrounded

### v0.0.2
* Added ability to jump to a line number entered as a command: `;42`
Expand Down
2 changes: 0 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
cmake_minimum_required(VERSION 3.22.0)
set(CMAKE_CXX_COMPILER "/usr/bin/clang++")
project(iris LANGUAGES CXX)

option(RUN_TESTS "Run unit tests" OFF)
Expand All @@ -21,7 +20,6 @@ add_compile_options(-Wall)
add_compile_options(-Wextra)
add_compile_options(-pedantic)
add_compile_options(-Wconversion)
add_compile_options(-Wno-implicit-int-float-conversion)
add_compile_options(-Wimplicit-fallthrough)

if(ENABLE_ASAN)
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ perform the following actions (alphabetically ordered):
| <kbd>b</kbd> | Move cursor back one word |
| <kbd>dl</kbd> | Delete the current line |
| <kbd>dw</kbd> | Delete the current word |
| <kbd>f</kbd> | Find next entered char ahead in file |
| <kbd>e</kbd> | Find next entered char ahead in file |
| <kbd>f</kbd> | Move cursor to end of current word |
| <kbd>F</kbd> | Find next entered char back in file |
| <kbd>g</kbd> | Go to top of file |
| <kbd>G</kbd> | Go to bottom of file |
Expand Down Expand Up @@ -92,6 +93,7 @@ following commands in alphabetical order are available:
| `;w` | Save file |
| `;wa` | Save all files |
| `;qa` | Quit all |
| `;wqa` | Write and quit all files |

Search flags for `;s` include:
* `m` Multiline search
Expand Down
2 changes: 0 additions & 2 deletions cmake/ci_toolchain.cmake

This file was deleted.

7 changes: 7 additions & 0 deletions include/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,10 @@
- `cmake -S . - B build && cmake --build build`
- Install it to this repo
- `cmake --install build --prefix ../iris/include/catch2`

### SPDLOG
- Clone the git repo: `git@github.com:gabime/spdlog.git` and checkout the git tag
- Currently, git commit `32dd298d` is used as the latest tag (v1.16.0) does
not work with clang21
- copy `spdlog/include/spdlog` to `iris/include/spdlog`

142 changes: 70 additions & 72 deletions include/spdlog/async.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,88 +14,86 @@
// This is because each message in the queue holds a shared_ptr to the
// originating logger.

#include <functional>
#include <memory>
#include <mutex>

#include <spdlog/async_logger.h>
#include <spdlog/details/registry.h>
#include <spdlog/details/thread_pool.h>

namespace spdlog {

namespace details {
static const size_t default_async_q_size = 8192;
}

// async logger factory - creates async loggers backed with thread pool.
// if a global thread pool doesn't already exist, create it with default queue
// size of 8192 items and single thread.
template <async_overflow_policy OverflowPolicy = async_overflow_policy::block>
struct async_factory_impl {
template <typename Sink, typename... SinkArgs>
static std::shared_ptr<async_logger> create(std::string logger_name, SinkArgs&&... args) {
auto& registry_inst = details::registry::instance();

// create global thread pool if not already exists..

auto& mutex = registry_inst.tp_mutex();
std::lock_guard<std::recursive_mutex> tp_lock(mutex);
auto tp = registry_inst.get_tp();
if (tp == nullptr) {
tp = std::make_shared<details::thread_pool>(details::default_async_q_size, 1U);
registry_inst.set_tp(tp);
}

auto sink = std::make_shared<Sink>(std::forward<SinkArgs>(args)...);
auto new_logger = std::make_shared<async_logger>(
std::move(logger_name), std::move(sink), std::move(tp), OverflowPolicy);
registry_inst.initialize_logger(new_logger);
return new_logger;
}
};
#include <functional>
#include <memory>
#include <mutex>

using async_factory = async_factory_impl<async_overflow_policy::block>;
using async_factory_nonblock = async_factory_impl<async_overflow_policy::overrun_oldest>;
namespace spdlog {

template <typename Sink, typename... SinkArgs>
inline std::shared_ptr<spdlog::logger> create_async(
std::string logger_name,
SinkArgs&&... sink_args) {
return async_factory::create<Sink>(
std::move(logger_name), std::forward<SinkArgs>(sink_args)...);
}
namespace details {
static const size_t default_async_q_size = 8192;
}

// async logger factory - creates async loggers backed with thread pool.
// if a global thread pool doesn't already exist, create it with default queue
// size of 8192 items and single thread.
template <async_overflow_policy OverflowPolicy = async_overflow_policy::block>
struct async_factory_impl {
template <typename Sink, typename... SinkArgs>
inline std::shared_ptr<spdlog::logger> create_async_nb(
std::string logger_name,
SinkArgs&&... sink_args) {
return async_factory_nonblock::create<Sink>(
std::move(logger_name), std::forward<SinkArgs>(sink_args)...);
}
static std::shared_ptr<async_logger> create(std::string logger_name, SinkArgs &&...args) {
auto &registry_inst = details::registry::instance();

// set global thread pool.
inline void init_thread_pool(
size_t q_size,
size_t thread_count,
std::function<void()> on_thread_start,
std::function<void()> on_thread_stop) {
auto tp = std::make_shared<details::thread_pool>(
q_size, thread_count, on_thread_start, on_thread_stop);
details::registry::instance().set_tp(std::move(tp));
}

inline void
init_thread_pool(size_t q_size, size_t thread_count, std::function<void()> on_thread_start) {
init_thread_pool(q_size, thread_count, on_thread_start, [] {});
}
// create global thread pool if not already exists..

inline void init_thread_pool(size_t q_size, size_t thread_count) {
init_thread_pool(q_size, thread_count, [] {}, [] {});
}
auto &mutex = registry_inst.tp_mutex();
std::lock_guard<std::recursive_mutex> tp_lock(mutex);
auto tp = registry_inst.get_tp();
if (tp == nullptr) {
tp = std::make_shared<details::thread_pool>(details::default_async_q_size, 1U);
registry_inst.set_tp(tp);
}

// get the global thread pool.
inline std::shared_ptr<spdlog::details::thread_pool> thread_pool() {
return details::registry::instance().get_tp();
auto sink = std::make_shared<Sink>(std::forward<SinkArgs>(args)...);
auto new_logger = std::make_shared<async_logger>(std::move(logger_name), std::move(sink),
std::move(tp), OverflowPolicy);
registry_inst.initialize_logger(new_logger);
return new_logger;
}
};

using async_factory = async_factory_impl<async_overflow_policy::block>;
using async_factory_nonblock = async_factory_impl<async_overflow_policy::overrun_oldest>;

template <typename Sink, typename... SinkArgs>
inline std::shared_ptr<spdlog::logger> create_async(std::string logger_name,
SinkArgs &&...sink_args) {
return async_factory::create<Sink>(std::move(logger_name),
std::forward<SinkArgs>(sink_args)...);
}

template <typename Sink, typename... SinkArgs>
inline std::shared_ptr<spdlog::logger> create_async_nb(std::string logger_name,
SinkArgs &&...sink_args) {
return async_factory_nonblock::create<Sink>(std::move(logger_name),
std::forward<SinkArgs>(sink_args)...);
}

// set global thread pool.
inline void init_thread_pool(size_t q_size,
size_t thread_count,
std::function<void()> on_thread_start,
std::function<void()> on_thread_stop) {
auto tp = std::make_shared<details::thread_pool>(q_size, thread_count, on_thread_start,
on_thread_stop);
details::registry::instance().set_tp(std::move(tp));
}

inline void init_thread_pool(size_t q_size,
size_t thread_count,
std::function<void()> on_thread_start) {
init_thread_pool(q_size, thread_count, on_thread_start, [] {});
}

inline void init_thread_pool(size_t q_size, size_t thread_count) {
init_thread_pool(q_size, thread_count, [] {}, [] {});
}

// get the global thread pool.
inline std::shared_ptr<spdlog::details::thread_pool> thread_pool() {
return details::registry::instance().get_tp();
}
} // namespace spdlog
Loading