Skip to content

Commit

Permalink
modernize (#334)
Browse files Browse the repository at this point in the history
  • Loading branch information
flagarde authored Nov 16, 2023
1 parent c4e0e89 commit 8f0f3e5
Showing 1 changed file with 38 additions and 44 deletions.
82 changes: 38 additions & 44 deletions examples/kilo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,11 @@
namespace
{

const std::string KILO_VERSION{"0.0.1"};
const int KILO_TAB_STOP{8};
const int KILO_QUIT_TIMES{3};
const std::string KILO_VERSION{"0.0.1"};

Check warning on line 36 in examples/kilo.cpp

View workflow job for this annotation

GitHub Actions / cpp-linter

/examples/kilo.cpp:36:1 [fuchsia-statically-constructed-objects]

static objects are disallowed; if possible, use a constexpr constructor instead

Check warning on line 36 in examples/kilo.cpp

View workflow job for this annotation

GitHub Actions / cpp-linter

/examples/kilo.cpp:36:29 [cert-err58-cpp]

initialization of 'KILO_VERSION' with static storage duration may throw an exception that cannot be caught
const constexpr std::size_t KILO_TAB_STOP{8};
const constexpr std::size_t KILO_QUIT_TIMES{3};
const constexpr std::size_t HL_HIGHLIGHT_NUMBERS(1UL << 0UL);
const constexpr std::size_t HL_HIGHLIGHT_STRINGS(1UL << 1UL);

enum editorHighlight
{
Expand All @@ -49,9 +51,6 @@ enum editorHighlight
HL_MATCH
};

#define HL_HIGHLIGHT_NUMBERS (1 << 0)
#define HL_HIGHLIGHT_STRINGS (1 << 1)

/*** data ***/

class editorSyntax
Expand All @@ -72,16 +71,17 @@ class editorSyntax
bool m_empty{true};
};

typedef struct erow
class erow
{
int idx;
int size;
int rsize;
char* chars;
char* render;
unsigned char* hl;
int hl_open_comment;
} erow;
public:
int idx{0};
int size{0};
int rsize{0};
char* chars{nullptr};
char* render{nullptr};
unsigned char* hl{nullptr};
int hl_open_comment{0};
};

class editorConfig
{
Expand All @@ -107,10 +107,9 @@ class editorConfig
std::size_t screencols{0};
std::size_t numrows{0};
erow* row{nullptr};
int dirty{0};
bool dirty{false};
std::string filename;
std::string statusmsg;
time_t statusmsg_time{0};
editorSyntax syntax;

private:
Expand Down Expand Up @@ -385,7 +384,7 @@ void editorInsertRow(int at, const char* s, std::size_t len)
editorUpdateRow(&E.row[at]);

E.numrows++;
E.dirty++;
E.dirty = true;
}

void editorFreeRow(erow* row)
Expand All @@ -402,7 +401,7 @@ void editorDelRow(int at)
memmove(&E.row[at], &E.row[at + 1], sizeof(erow) * (static_cast<size_t>(E.numrows) - at - 1));
for(int j = at; j < E.numrows - 1; j++) E.row[j].idx--;

Check warning on line 402 in examples/kilo.cpp

View workflow job for this annotation

GitHub Actions / macos-11 gcc-10 (c++17)

comparison of integer expressions of different signedness: 'int' and 'std::size_t' {aka 'long unsigned int'} [-Wsign-compare]

Check warning on line 402 in examples/kilo.cpp

View workflow job for this annotation

GitHub Actions / clang64 (c++11)

comparison of integers of different signs: 'int' and 'std::size_t' (aka 'unsigned long long') [-Wsign-compare]

Check warning on line 402 in examples/kilo.cpp

View workflow job for this annotation

GitHub Actions / clang32 (c++17)

comparison of integers of different signs: 'int' and 'std::size_t' (aka 'unsigned int') [-Wsign-compare]

Check warning on line 402 in examples/kilo.cpp

View workflow job for this annotation

GitHub Actions / clang32 (c++11)

comparison of integers of different signs: 'int' and 'std::size_t' (aka 'unsigned int') [-Wsign-compare]

Check warning on line 402 in examples/kilo.cpp

View workflow job for this annotation

GitHub Actions / clang64 (c++14)

comparison of integers of different signs: 'int' and 'std::size_t' (aka 'unsigned long long') [-Wsign-compare]

Check warning on line 402 in examples/kilo.cpp

View workflow job for this annotation

GitHub Actions / clang32 (c++20)

comparison of integers of different signs: 'int' and 'std::size_t' (aka 'unsigned int') [-Wsign-compare]

Check warning on line 402 in examples/kilo.cpp

View workflow job for this annotation

GitHub Actions / clang64 (c++20)

comparison of integers of different signs: 'int' and 'std::size_t' (aka 'unsigned long long') [-Wsign-compare]

Check warning on line 402 in examples/kilo.cpp

View workflow job for this annotation

GitHub Actions / macos-11 gcc-12 (c++11)

comparison of integer expressions of different signedness: 'int' and 'std::size_t' {aka 'long unsigned int'} [-Wsign-compare]

Check warning on line 402 in examples/kilo.cpp

View workflow job for this annotation

GitHub Actions / macos-11 gcc-11 (c++17)

comparison of integer expressions of different signedness: 'int' and 'std::size_t' {aka 'long unsigned int'} [-Wsign-compare]

Check warning on line 402 in examples/kilo.cpp

View workflow job for this annotation

GitHub Actions / mingw32 (c++11)

comparison of integer expressions of different signedness: 'int' and 'std::size_t' {aka 'unsigned int'} [-Wsign-compare]

Check warning on line 402 in examples/kilo.cpp

View workflow job for this annotation

GitHub Actions / macos-11 gcc-11 (c++20)

comparison of integer expressions of different signedness: 'int' and 'std::size_t' {aka 'long unsigned int'} [-Wsign-compare]

Check warning on line 402 in examples/kilo.cpp

View workflow job for this annotation

GitHub Actions / macos-11 gcc-10 (c++20)

comparison of integer expressions of different signedness: 'int' and 'std::size_t' {aka 'long unsigned int'} [-Wsign-compare]

Check warning on line 402 in examples/kilo.cpp

View workflow job for this annotation

GitHub Actions / clang32 (c++14)

comparison of integers of different signs: 'int' and 'std::size_t' (aka 'unsigned int') [-Wsign-compare]

Check warning on line 402 in examples/kilo.cpp

View workflow job for this annotation

GitHub Actions / clang64 (c++17)

comparison of integers of different signs: 'int' and 'std::size_t' (aka 'unsigned long long') [-Wsign-compare]

Check warning on line 402 in examples/kilo.cpp

View workflow job for this annotation

GitHub Actions / mingw32 (c++17)

comparison of integer expressions of different signedness: 'int' and 'std::size_t' {aka 'unsigned int'} [-Wsign-compare]

Check warning on line 402 in examples/kilo.cpp

View workflow job for this annotation

GitHub Actions / mingw64 (c++17)

comparison of integer expressions of different signedness: 'int' and 'std::size_t' {aka 'long long unsigned int'} [-Wsign-compare]

Check warning on line 402 in examples/kilo.cpp

View workflow job for this annotation

GitHub Actions / macos-11 gcc-12 (c++14)

comparison of integer expressions of different signedness: 'int' and 'std::size_t' {aka 'long unsigned int'} [-Wsign-compare]

Check warning on line 402 in examples/kilo.cpp

View workflow job for this annotation

GitHub Actions / mingw64 (c++14)

comparison of integer expressions of different signedness: 'int' and 'std::size_t' {aka 'long long unsigned int'} [-Wsign-compare]

Check warning on line 402 in examples/kilo.cpp

View workflow job for this annotation

GitHub Actions / mingw32 (c++20)

comparison of integer expressions of different signedness: 'int' and 'std::size_t' {aka 'unsigned int'} [-Wsign-compare]

Check warning on line 402 in examples/kilo.cpp

View workflow job for this annotation

GitHub Actions / macos-11 gcc-12 (c++17)

comparison of integer expressions of different signedness: 'int' and 'std::size_t' {aka 'long unsigned int'} [-Wsign-compare]

Check warning on line 402 in examples/kilo.cpp

View workflow job for this annotation

GitHub Actions / ucrt64 (c++11)

comparison of integer expressions of different signedness: 'int' and 'std::size_t' {aka 'long long unsigned int'} [-Wsign-compare]

Check warning on line 402 in examples/kilo.cpp

View workflow job for this annotation

GitHub Actions / macos-11 xcode-11.7 (c++11)

comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]

Check warning on line 402 in examples/kilo.cpp

View workflow job for this annotation

GitHub Actions / mingw64 (c++20)

comparison of integer expressions of different signedness: 'int' and 'std::size_t' {aka 'long long unsigned int'} [-Wsign-compare]

Check warning on line 402 in examples/kilo.cpp

View workflow job for this annotation

GitHub Actions / mingw32 (c++14)

comparison of integer expressions of different signedness: 'int' and 'std::size_t' {aka 'unsigned int'} [-Wsign-compare]

Check warning on line 402 in examples/kilo.cpp

View workflow job for this annotation

GitHub Actions / macos-11 xcode-11.7 (c++14)

comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]

Check warning on line 402 in examples/kilo.cpp

View workflow job for this annotation

GitHub Actions / macos-11 xcode-11.7 (c++17)

comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]

Check warning on line 402 in examples/kilo.cpp

View workflow job for this annotation

GitHub Actions / macos-11 xcode-11.7 (c++20)

comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]

Check warning on line 402 in examples/kilo.cpp

View workflow job for this annotation

GitHub Actions / macos-11 xcode-12.4 (c++11)

comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]

Check warning on line 402 in examples/kilo.cpp

View workflow job for this annotation

GitHub Actions / macos-11 xcode-12.4 (c++14)

comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]

Check warning on line 402 in examples/kilo.cpp

View workflow job for this annotation

GitHub Actions / mingw64 (c++11)

comparison of integer expressions of different signedness: 'int' and 'std::size_t' {aka 'long long unsigned int'} [-Wsign-compare]

Check warning on line 402 in examples/kilo.cpp

View workflow job for this annotation

GitHub Actions / ucrt64 (c++14)

comparison of integer expressions of different signedness: 'int' and 'std::size_t' {aka 'long long unsigned int'} [-Wsign-compare]

Check warning on line 402 in examples/kilo.cpp

View workflow job for this annotation

GitHub Actions / ucrt64 (c++17)

comparison of integer expressions of different signedness: 'int' and 'std::size_t' {aka 'long long unsigned int'} [-Wsign-compare]

Check warning on line 402 in examples/kilo.cpp

View workflow job for this annotation

GitHub Actions / macos-11 xcode-12.4 (c++20)

comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]

Check warning on line 402 in examples/kilo.cpp

View workflow job for this annotation

GitHub Actions / ucrt64 (c++20)

comparison of integer expressions of different signedness: 'int' and 'std::size_t' {aka 'long long unsigned int'} [-Wsign-compare]

Check warning on line 402 in examples/kilo.cpp

View workflow job for this annotation

GitHub Actions / macos-11 xcode-12.4 (c++17)

comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]

Check warning on line 402 in examples/kilo.cpp

View workflow job for this annotation

GitHub Actions / windows-2019 clang-11.1.0 (c++11)

comparison of integers of different signs: 'int' and 'unsigned long long' [-Wsign-compare]

Check warning on line 402 in examples/kilo.cpp

View workflow job for this annotation

GitHub Actions / macos-11 xcode-12.5.1 (c++14)

comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]

Check warning on line 402 in examples/kilo.cpp

View workflow job for this annotation

GitHub Actions / macos-11 xcode-12.5.1 (c++11)

comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]

Check warning on line 402 in examples/kilo.cpp

View workflow job for this annotation

GitHub Actions / macos-11 xcode-12.5.1 (c++20)

comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]

Check warning on line 402 in examples/kilo.cpp

View workflow job for this annotation

GitHub Actions / windows-2019 clang-11.1.0 (c++14)

comparison of integers of different signs: 'int' and 'unsigned long long' [-Wsign-compare]

Check warning on line 402 in examples/kilo.cpp

View workflow job for this annotation

GitHub Actions / windows-2019 clang-11.1.0 (c++17)

comparison of integers of different signs: 'int' and 'unsigned long long' [-Wsign-compare]

Check warning on line 402 in examples/kilo.cpp

View workflow job for this annotation

GitHub Actions / windows-2019 clang-11.1.0 (c++20)

comparison of integers of different signs: 'int' and 'unsigned long long' [-Wsign-compare]

Check warning on line 402 in examples/kilo.cpp

View workflow job for this annotation

GitHub Actions / windows-2019 clang-12.0.1 (c++11)

comparison of integers of different signs: 'int' and 'unsigned long long' [-Wsign-compare]

Check warning on line 402 in examples/kilo.cpp

View workflow job for this annotation

GitHub Actions / windows-2019 clang-12.0.1 (c++14)

comparison of integers of different signs: 'int' and 'unsigned long long' [-Wsign-compare]

Check warning on line 402 in examples/kilo.cpp

View workflow job for this annotation

GitHub Actions / macos-11 xcode-12.5.1 (c++17)

comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]

Check warning on line 402 in examples/kilo.cpp

View workflow job for this annotation

GitHub Actions / windows-2019 clang-12.0.1 (c++17)

comparison of integers of different signs: 'int' and 'unsigned long long' [-Wsign-compare]

Check warning on line 402 in examples/kilo.cpp

View workflow job for this annotation

GitHub Actions / windows-2019 clang-12.0.1 (c++20)

comparison of integers of different signs: 'int' and 'unsigned long long' [-Wsign-compare]

Check warning on line 402 in examples/kilo.cpp

View workflow job for this annotation

GitHub Actions / macos-12 xcode-13.1 (c++11)

comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]

Check warning on line 402 in examples/kilo.cpp

View workflow job for this annotation

GitHub Actions / macos-12 xcode-13.1 (c++14)

comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]

Check warning on line 402 in examples/kilo.cpp

View workflow job for this annotation

GitHub Actions / macos-12 xcode-13.1 (c++20)

comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]

Check warning on line 402 in examples/kilo.cpp

View workflow job for this annotation

GitHub Actions / macos-12 xcode-13.2.1 (c++11)

comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]

Check warning on line 402 in examples/kilo.cpp

View workflow job for this annotation

GitHub Actions / macos-12 xcode-13.1 (c++17)

comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]

Check warning on line 402 in examples/kilo.cpp

View workflow job for this annotation

GitHub Actions / macos-12 xcode-13.2.1 (c++14)

comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]

Check warning on line 402 in examples/kilo.cpp

View workflow job for this annotation

GitHub Actions / macos-12 xcode-13.3.1 (c++11)

comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]

Check warning on line 402 in examples/kilo.cpp

View workflow job for this annotation

GitHub Actions / macos-12 xcode-13.2.1 (c++20)

comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]

Check warning on line 402 in examples/kilo.cpp

View workflow job for this annotation

GitHub Actions / macos-12 xcode-13.3.1 (c++17)

comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]

Check warning on line 402 in examples/kilo.cpp

View workflow job for this annotation

GitHub Actions / macos-12 xcode-13.2.1 (c++17)

comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]

Check warning on line 402 in examples/kilo.cpp

View workflow job for this annotation

GitHub Actions / macos-12 xcode-13.3.1 (c++20)

comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]

Check warning on line 402 in examples/kilo.cpp

View workflow job for this annotation

GitHub Actions / macos-12 xcode-13.3.1 (c++14)

comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]
E.numrows--;
E.dirty++;
E.dirty = true;
}

void editorRowInsertChar(erow* row, int at, int c)
Expand All @@ -414,7 +413,7 @@ void editorRowInsertChar(erow* row, int at, int c)
row->size++;
row->chars[at] = static_cast<char>(c);
editorUpdateRow(row);
E.dirty++;
E.dirty = true;
}

void editorRowAppendString(erow* row, char* s, std::size_t len)
Expand All @@ -425,7 +424,7 @@ void editorRowAppendString(erow* row, char* s, std::size_t len)
row->size += static_cast<int>(len);
row->chars[row->size] = '\0';
editorUpdateRow(row);
E.dirty++;
E.dirty = true;
}

void editorRowDelChar(erow* row, int at)
Expand All @@ -434,7 +433,7 @@ void editorRowDelChar(erow* row, int at)
memmove(&row->chars[at], &row->chars[at + 1], static_cast<size_t>(row->size) - at);
row->size--;
editorUpdateRow(row);
E.dirty++;
E.dirty = true;
}

/*** editor operations ***/
Expand Down Expand Up @@ -507,7 +506,7 @@ void editorOpen(const std::string& filename)
editorInsertRow(E.numrows, line.c_str(), linelen);
std::getline(file, line);
}
E.dirty = 0;
E.dirty = false;
}

void editorSetStatusMessage(const std::string fmt, ...)
Expand All @@ -516,7 +515,6 @@ void editorSetStatusMessage(const std::string fmt, ...)
va_start(ap, fmt);
vsnprintf(&E.statusmsg[0], E.statusmsg.capacity(), fmt.c_str(), ap);
va_end(ap);
E.statusmsg_time = time(nullptr);
}

void editorSave()
Expand All @@ -537,7 +535,7 @@ void editorSave()
out.open(E.filename);
out << text;
out.close();
E.dirty = 0;
E.dirty = false;
editorSetStatusMessage("%d bytes written to disk", text.size());
}

Expand Down Expand Up @@ -703,24 +701,20 @@ void editorDrawRows(std::string& screen)
void editorDrawStatusBar(std::string& screen)
{
screen.append(style(Term::Style::Reversed));
char status[80];
char rstatus[80];
int len = snprintf(status, sizeof(status), "%.20s - %d lines %s", !E.filename.empty() ? E.filename.c_str() : "[No Name]", E.numrows, E.dirty ? "(modified)" : "");
int rlen = snprintf(rstatus, sizeof(rstatus), "%s | %ld/%ld", !E.syntax.empty() ? E.syntax.filetype.c_str() : "no ft", E.cy + 1, E.numrows);
if(len > E.screencols) len = E.screencols;
screen.append(std::string(status, len));
while(len < E.screencols)
std::string left1;
if(!E.filename.empty()) { left1 += E.filename; }
else { left1 += "[No Name]"; }
std::string left2 = " - " + std::to_string(E.numrows) + " lines ";
if(E.dirty) { left2 += "(modified)"; }
std::string right;
if(!E.syntax.empty()) { right += E.syntax.filetype + " | "; }
else { right += "no ft | "; }
right += std::to_string(E.cy + 1) + "/" + std::to_string(E.numrows);
if((left1.size() + left2.size() + right.size()) < E.screencols) { screen += left1 + left2 + std::string(E.screencols - right.size() - left1.size() - left2.size(), ' ') + right; }
else
{
if(E.screencols - len == rlen)
{
screen.append(std::string(rstatus, rlen));
break;
}
else
{
screen.append(" ");
++len;
}
const std::size_t size = right.size() + left2.size();
if(E.screencols - size > 0 && (left1.size() - E.screencols + size) < left1.size()) screen += left1.substr(left1.size() - E.screencols + size, E.screencols - size) + left2 + right;
}
screen.append(style(Term::Style::Reset));
screen.append("\r\n");
Expand All @@ -730,7 +724,7 @@ void editorDrawMessageBar(std::string& screen)
{
screen.append(Term::clear_eol());
if(E.statusmsg.size() > E.screencols) E.statusmsg.resize(E.screencols);
if(!E.statusmsg.empty() && (time(nullptr) - E.statusmsg_time) < 5) { screen.append(E.statusmsg); }
if(!E.statusmsg.empty()) { screen.append(E.statusmsg); }
}

void editorRefreshScreen()
Expand Down Expand Up @@ -842,7 +836,7 @@ bool editorProcessKeypress()
}
case Term::Key::Ctrl_Q:
{
if(E.dirty && quit_times > 0)
if(E.dirty == true && quit_times > 0)
{
::editorSetStatusMessage("WARNING!!! File has unsaved changes. Press Ctrl-Q %d more times to quit.", quit_times);
--quit_times;
Expand Down

1 comment on commit 8f0f3e5

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cpp-Linter Report ⚠️

Some files did not pass the configured checks!

clang-tidy reports: 312 concern(s)
  • examples/kilo.cpp

    /examples/kilo.cpp:36:1: warning: [fuchsia-statically-constructed-objects]

    static objects are disallowed; if possible, use a constexpr constructor instead

       36 | const std::string           KILO_VERSION{"0.0.1"};
          | ^

    /examples/kilo.cpp:36:29: warning: [cert-err58-cpp]

    initialization of 'KILO_VERSION' with static storage duration may throw an exception that cannot be caught

       36 | const std::string           KILO_VERSION{"0.0.1"};
          |                             ^
    /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/basic_string.h:631:7: note: possibly throwing constructor declared here
      631 |       basic_string(const _CharT* __s, const _Alloc& __a = _Alloc())
          |       ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:59:3: warning: constructor does not initialize these fields: flags [cppcoreguidelines-pro-type-member-init,hicpp-member-init]
       59 |   editorSyntax() : keywords(nullptr) {}
          |   ^
       60 |   editorSyntax(const std::string& type, const std::vector<std::string>& match, const char** key, const std::string& sc, const std::string& mcs, const std::string& mce, const std::size_t& flag) : filetype(type), filematch(match), keywords(key), singleline_comment_start(sc), multiline_comment_start(mcs), multiline_comment_end(mce), flags(flag) { m_empty = false; }
       61 |   bool                     empty() const noexcept { return m_empty; }
       62 |   std::string              filetype;
       63 |   std::vector<std::string> filematch;
       64 |   const char**             keywords;
       65 |   std::string              singleline_comment_start;
       66 |   std::string              multiline_comment_start;
       67 |   std::string              multiline_comment_end;
       68 |   std::size_t              flags;
          |                                 
          |                                 {}

    /examples/kilo.cpp:60:98: warning: [bugprone-easily-swappable-parameters]

    2 adjacent parameters of 'editorSyntax' of similar type ('const std::string &') are easily swapped by mistake

       60 |   editorSyntax(const std::string& type, const std::vector<std::string>& match, const char** key, const std::string& sc, const std::string& mcs, const std::string& mce, const std::size_t& flag) : filetype(type), filematch(match), keywords(key), singleline_comment_start(sc), multiline_comment_start(mcs), multiline_comment_end(mce), flags(flag) { m_empty = false; }
          |                                                                                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:60:117: note: the first parameter in the range is 'sc'
       60 |   editorSyntax(const std::string& type, const std::vector<std::string>& match, const char** key, const std::string& sc, const std::string& mcs, const std::string& mce, const std::size_t& flag) : filetype(type), filematch(match), keywords(key), singleline_comment_start(sc), multiline_comment_start(mcs), multiline_comment_end(mce), flags(flag) { m_empty = false; }
          |                                                                                                                     ^~
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:60:140: note: the last parameter in the range is 'mcs'
       60 |   editorSyntax(const std::string& type, const std::vector<std::string>& match, const char** key, const std::string& sc, const std::string& mcs, const std::string& mce, const std::size_t& flag) : filetype(type), filematch(match), keywords(key), singleline_comment_start(sc), multiline_comment_start(mcs), multiline_comment_end(mce), flags(flag) { m_empty = false; }
          |                                                                                                                                            ^~~

    /examples/kilo.cpp:60:117: warning: [readability-identifier-length]

    parameter name 'sc' is too short, expected at least 3 characters

       60 |   editorSyntax(const std::string& type, const std::vector<std::string>& match, const char** key, const std::string& sc, const std::string& mcs, const std::string& mce, const std::size_t& flag) : filetype(type), filematch(match), keywords(key), singleline_comment_start(sc), multiline_comment_start(mcs), multiline_comment_end(mce), flags(flag) { m_empty = false; }
          |                                                                                                                     ^

    /examples/kilo.cpp:60:347: warning: [cppcoreguidelines-prefer-member-initializer]

    'm_empty' should be initialized in a member initializer of the constructor

       60 |   editorSyntax(const std::string& type, const std::vector<std::string>& match, const char** key, const std::string& sc, const std::string& mcs, const std::string& mce, const std::size_t& flag) : filetype(type), filematch(match), keywords(key), singleline_comment_start(sc), multiline_comment_start(mcs), multiline_comment_end(mce), flags(flag) { m_empty = false; }
          |                                                                                                                                                                                                                                                                                                                                                           ^~~~~~~~~~~~~~~~
          |                                                                                                                                                                                                                                                                                                                                                        , m_empty(false)
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:62:28: warning: member variable 'filetype' has public visibility [cppcoreguidelines-non-private-member-variables-in-classes,misc-non-private-member-variables-in-classes]
       62 |   std::string              filetype;
          |                            ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:63:28: warning: member variable 'filematch' has public visibility [cppcoreguidelines-non-private-member-variables-in-classes,misc-non-private-member-variables-in-classes]
       63 |   std::vector<std::string> filematch;
          |                            ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:64:28: warning: member variable 'keywords' has public visibility [cppcoreguidelines-non-private-member-variables-in-classes,misc-non-private-member-variables-in-classes]
       64 |   const char**             keywords;
          |                            ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:65:28: warning: member variable 'singleline_comment_start' has public visibility [cppcoreguidelines-non-private-member-variables-in-classes,misc-non-private-member-variables-in-classes]
       65 |   std::string              singleline_comment_start;
          |                            ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:66:28: warning: member variable 'multiline_comment_start' has public visibility [cppcoreguidelines-non-private-member-variables-in-classes,misc-non-private-member-variables-in-classes]
       66 |   std::string              multiline_comment_start;
          |                            ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:67:28: warning: member variable 'multiline_comment_end' has public visibility [cppcoreguidelines-non-private-member-variables-in-classes,misc-non-private-member-variables-in-classes]
       67 |   std::string              multiline_comment_end;
          |                            ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:68:28: warning: member variable 'flags' has public visibility [cppcoreguidelines-non-private-member-variables-in-classes,misc-non-private-member-variables-in-classes]
       68 |   std::size_t              flags;
          |                            ^

    /examples/kilo.cpp:101:16: warning: [misc-non-private-member-variables-in-classes]

    member variable 'cx' has public visibility

      101 |   std::size_t  cx{0};
          |                ^

    /examples/kilo.cpp:102:16: warning: [misc-non-private-member-variables-in-classes]

    member variable 'cy' has public visibility

      102 |   std::size_t  cy{0};
          |                ^

    /examples/kilo.cpp:103:16: warning: [misc-non-private-member-variables-in-classes]

    member variable 'rx' has public visibility

      103 |   int          rx{0};
          |                ^

    /examples/kilo.cpp:104:16: warning: [misc-non-private-member-variables-in-classes]

    member variable 'rowoff' has public visibility

      104 |   std::size_t  rowoff{0};
          |                ^

    /examples/kilo.cpp:105:16: warning: [misc-non-private-member-variables-in-classes]

    member variable 'coloff' has public visibility

      105 |   std::size_t  coloff{0};
          |                ^

    /examples/kilo.cpp:106:16: warning: [misc-non-private-member-variables-in-classes]

    member variable 'screenrows' has public visibility

      106 |   std::size_t  screenrows{0};
          |                ^

    /examples/kilo.cpp:107:16: warning: [misc-non-private-member-variables-in-classes]

    member variable 'screencols' has public visibility

      107 |   std::size_t  screencols{0};
          |                ^

    /examples/kilo.cpp:108:16: warning: [misc-non-private-member-variables-in-classes]

    member variable 'numrows' has public visibility

      108 |   std::size_t  numrows{0};
          |                ^

    /examples/kilo.cpp:109:16: warning: [misc-non-private-member-variables-in-classes]

    member variable 'row' has public visibility

      109 |   erow*        row{nullptr};
          |                ^

    /examples/kilo.cpp:110:16: warning: [misc-non-private-member-variables-in-classes]

    member variable 'dirty' has public visibility

      110 |   bool         dirty{false};
          |                ^

    /examples/kilo.cpp:111:16: warning: [misc-non-private-member-variables-in-classes]

    member variable 'filename' has public visibility

      111 |   std::string  filename;
          |                ^

    /examples/kilo.cpp:112:16: warning: [misc-non-private-member-variables-in-classes]

    member variable 'statusmsg' has public visibility

      112 |   std::string  statusmsg;
          |                ^

    /examples/kilo.cpp:113:16: warning: [misc-non-private-member-variables-in-classes]

    member variable 'syntax' has public visibility

      113 |   editorSyntax syntax;
          |                ^

    /examples/kilo.cpp:119:1: warning: [fuchsia-statically-constructed-objects]

    static objects are disallowed; if possible, use a constexpr constructor instead

      119 | class editorConfig E;
          | ^

    /examples/kilo.cpp:119:20: warning: [cert-err58-cpp]

    initialization of 'E' with static storage duration may throw an exception that cannot be caught

      119 | class editorConfig E;
          |                    ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:89:3: note: possibly throwing constructor declared here
       89 |   editorConfig()
          |   ^

    /examples/kilo.cpp:119:20: warning: [readability-identifier-length]

    variable name 'E' is too short, expected at least 3 characters

      119 | class editorConfig E;
          |                    ^

    /examples/kilo.cpp:123:1: warning: [fuchsia-statically-constructed-objects]

    static objects are disallowed; if possible, use a constexpr constructor instead

      123 | const std::vector<std::string> C_HL_extensions = {".c", ".h", ".hpp", ".cpp"};
          | ^

    /examples/kilo.cpp:123:32: warning: [cert-err58-cpp]

    initialization of 'C_HL_extensions' with static storage duration may throw an exception that cannot be caught

      123 | const std::vector<std::string> C_HL_extensions = {".c", ".h", ".hpp", ".cpp"};
          |                                ^
    /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_vector.h:675:7: note: possibly throwing constructor declared here
      675 |       vector(initializer_list<value_type> __l,
          |       ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:124:7: warning: do not declare C-style arrays, use std::array<> instead [cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays]
      124 | const char*                    C_HL_keywords[] = {"switch", "if", "while", "for", "break", "continue", "return", "else", "struct", "union", "typedef", "static", "enum", "class", "case", "int|", "long|", "double|", "float|", "char|", "unsigned|", "signed|", "void|", "bool|", nullptr};
          |       ^

    /examples/kilo.cpp:126:1: warning: [fuchsia-statically-constructed-objects]

    static objects are disallowed; if possible, use a constexpr constructor instead

      126 | std::array<editorSyntax, 1> HLDB = {
          | ^

    /examples/kilo.cpp:126:6: warning: [misc-include-cleaner]

    no header providing "std::array" is directly included

       25 | std::array<editorSyntax, 1> HLDB = {
          |      ^

    /examples/kilo.cpp:126:29: warning: [cert-err58-cpp]

    initialization of 'HLDB' with static storage duration may throw an exception that cannot be caught

      126 | std::array<editorSyntax, 1> HLDB = {
          |                             ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:60:3: note: possibly throwing constructor declared here
       60 |   editorSyntax(const std::string& type, const std::vector<std::string>& match, const char** key, const std::string& sc, const std::string& mcs, const std::string& mce, const std::size_t& flag) : filetype(type), filematch(match), keywords(key), singleline_comment_start(sc), multiline_comment_start(mcs), multiline_comment_end(mce), flags(flag) { m_empty = false; }
          |   ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:127:38: warning: do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
      127 |   editorSyntax("c", C_HL_extensions, C_HL_keywords, "//", "/*", "*/", HL_HIGHLIGHT_NUMBERS | HL_HIGHLIGHT_STRINGS),
          |                                      ^

    /examples/kilo.cpp:136:30: warning: [readability-identifier-length]

    parameter name 'c' is too short, expected at least 3 characters

      136 | bool is_separator(const int& c) { return isspace(c) || c == '\0' || strchr(",.()+-/*=~%<>[];", c) != nullptr; }
          |                              ^

    /examples/kilo.cpp:136:42: warning: [misc-include-cleaner]

    no header providing "isspace" is directly included

       25 | bool is_separator(const int& c) { return isspace(c) || c == '\0' || strchr(",.()+-/*=~%<>[];", c) != nullptr; }
          |                                          ^

    /examples/kilo.cpp:136:42: warning: [readability-implicit-bool-conversion]

    implicit conversion 'int' -> bool

      136 | bool is_separator(const int& c) { return isspace(c) || c == '\0' || strchr(",.()+-/*=~%<>[];", c) != nullptr; }
          |                                          ^
          |                                          (          != 0)

    /examples/kilo.cpp:138:6: warning: [misc-no-recursion]

    function 'editorUpdateSyntax' is within a recursive call chain

      138 | void editorUpdateSyntax(erow* row)
          |      ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:138:6: note: example recursive call chain, starting from function 'editorUpdateSyntax'
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:267:43: note: Frame #1: function 'editorUpdateSyntax' calls function 'editorUpdateSyntax' here:
      267 |   if(changed && row->idx + 1 < E.numrows) editorUpdateSyntax(&E.row[row->idx + 1]);
          |                                           ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:267:43: note: ... which was the starting point of the recursive call chain; there may be other cycles

    /examples/kilo.cpp:138:6: warning: [readability-function-cognitive-complexity]

    function 'editorUpdateSyntax' has cognitive complexity of 77 (threshold 25)

      138 | void editorUpdateSyntax(erow* row)
          |      ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:141:3: note: +1, including nesting penalty of 0, nesting level increased to 1
      141 |   if(row->hl == nullptr) { exit(-1); /*TODO: better handler*/ }
          |   ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:144:3: note: +1, including nesting penalty of 0, nesting level increased to 1
      144 |   if(E.syntax.empty()) return;
          |   ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:154:35: note: +1
      154 |   int in_comment = (row->idx > 0) && (E.row[row->idx - 1].hl_open_comment != 0);
          |                                   ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:157:3: note: +1, including nesting penalty of 0, nesting level increased to 1
      157 |   while(i < static_cast<size_t>(row->rsize))
          |   ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:160:37: note: +2, including nesting penalty of 1, nesting level increased to 2
      160 |     unsigned char prev_hl = (i > 0) ? row->hl[i - 1] : static_cast<unsigned char>(HL_NORMAL);
          |                                     ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:162:5: note: +2, including nesting penalty of 1, nesting level increased to 2
      162 |     if(scs.size() && !in_string && !in_comment)
          |     ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:162:33: note: +1
      162 |     if(scs.size() && !in_string && !in_comment)
          |                                 ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:164:7: note: +3, including nesting penalty of 2, nesting level increased to 3
      164 |       if(!strncmp(&row->render[i], &scs[0], scs.size()))
          |       ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:171:5: note: +2, including nesting penalty of 1, nesting level increased to 2
      171 |     if(mcs.size() && mce.size() && !in_string)
          |     ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:171:33: note: +1
      171 |     if(mcs.size() && mce.size() && !in_string)
          |                                 ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:173:7: note: +3, including nesting penalty of 2, nesting level increased to 3
      173 |       if(in_comment)
          |       ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:176:9: note: +4, including nesting penalty of 3, nesting level increased to 4
      176 |         if(!strncmp(&row->render[i], &mce[0], mce.size()))
          |         ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:184:9: note: +1, nesting level increased to 4
      184 |         else
          |         ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:190:12: note: +1, nesting level increased to 3
      190 |       else if(!strncmp(&row->render[i], &mcs[0], mcs.size()))
          |            ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:199:5: note: +2, including nesting penalty of 1, nesting level increased to 2
      199 |     if(E.syntax.flags & HL_HIGHLIGHT_STRINGS)
          |     ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:201:7: note: +3, including nesting penalty of 2, nesting level increased to 3
      201 |       if(in_string)
          |       ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:204:9: note: +4, including nesting penalty of 3, nesting level increased to 4
      204 |         if(c == '\\' && i + 1 < static_cast<size_t>(row->rsize))
          |         ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:204:22: note: +1
      204 |         if(c == '\\' && i + 1 < static_cast<size_t>(row->rsize))
          |                      ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:210:9: note: +4, including nesting penalty of 3, nesting level increased to 4
      210 |         if(c == in_string) in_string = 0;
          |         ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:215:7: note: +1, nesting level increased to 3
      215 |       else
          |       ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:217:9: note: +4, including nesting penalty of 3, nesting level increased to 4
      217 |         if(c == '"' || c == '\'')
          |         ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:217:21: note: +1
      217 |         if(c == '"' || c == '\'')
          |                     ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:227:5: note: +2, including nesting penalty of 1, nesting level increased to 2
      227 |     if(E.syntax.flags & HL_HIGHLIGHT_NUMBERS)
          |     ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:229:7: note: +3, including nesting penalty of 2, nesting level increased to 3
      229 |       if((isdigit(c) && (prev_sep || prev_hl == HL_NUMBER)) || (c == '.' && prev_hl == HL_NUMBER))
          |       ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:229:61: note: +1
      229 |       if((isdigit(c) && (prev_sep || prev_hl == HL_NUMBER)) || (c == '.' && prev_hl == HL_NUMBER))
          |                                                             ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:229:22: note: +1
      229 |       if((isdigit(c) && (prev_sep || prev_hl == HL_NUMBER)) || (c == '.' && prev_hl == HL_NUMBER))
          |                      ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:229:35: note: +1
      229 |       if((isdigit(c) && (prev_sep || prev_hl == HL_NUMBER)) || (c == '.' && prev_hl == HL_NUMBER))
          |                                   ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:229:74: note: +1
      229 |       if((isdigit(c) && (prev_sep || prev_hl == HL_NUMBER)) || (c == '.' && prev_hl == HL_NUMBER))
          |                                                                          ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:238:5: note: +2, including nesting penalty of 1, nesting level increased to 2
      238 |     if(prev_sep)
          |     ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:241:7: note: +3, including nesting penalty of 2, nesting level increased to 3
      241 |       for(j = 0; keywords[j]; j++)
          |       ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:245:9: note: +4, including nesting penalty of 3, nesting level increased to 4
      245 |         if(kw2) klen--;
          |         ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:247:9: note: +4, including nesting penalty of 3, nesting level increased to 4
      247 |         if(!strncmp(&row->render[i], keywords[j], klen) && is_separator(row->render[i + klen]))
          |         ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:247:57: note: +1
      247 |         if(!strncmp(&row->render[i], keywords[j], klen) && is_separator(row->render[i + klen]))
          |                                                         ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:249:35: note: +5, including nesting penalty of 4, nesting level increased to 5
      249 |           memset(&row->hl[i], kw2 ? HL_KEYWORD2 : HL_KEYWORD1, static_cast<size_t>(klen));
          |                                   ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:254:7: note: +3, including nesting penalty of 2, nesting level increased to 3
      254 |       if(keywords[j] != nullptr)
          |       ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:267:3: note: +1, including nesting penalty of 0, nesting level increased to 1
      267 |   if(changed && row->idx + 1 < E.numrows) editorUpdateSyntax(&E.row[row->idx + 1]);
          |   ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:267:14: note: +1
      267 |   if(changed && row->idx + 1 < E.numrows) editorUpdateSyntax(&E.row[row->idx + 1]);
          |              ^

    /examples/kilo.cpp:140:3: warning: [cppcoreguidelines-owning-memory]

    assigning newly created 'gsl::owner<>' to non-owner 'unsigned char *'

      140 |   row->hl = reinterpret_cast<unsigned char*>(realloc(row->hl, static_cast<size_t>(row->rsize)));
          |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    /examples/kilo.cpp:140:13: warning: [cppcoreguidelines-pro-type-reinterpret-cast]

    do not use reinterpret_cast

      140 |   row->hl = reinterpret_cast<unsigned char*>(realloc(row->hl, static_cast<size_t>(row->rsize)));
          |             ^

    /examples/kilo.cpp:140:46: warning: [bugprone-suspicious-realloc-usage]

    'row->hl' may be set to null if 'realloc' fails, which may result in a leak of the original buffer

      140 |   row->hl = reinterpret_cast<unsigned char*>(realloc(row->hl, static_cast<size_t>(row->rsize)));
          |   ~~~~~~~                                    ^       ~~~~~~~
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:140:46: warning: do not manage memory manually; consider std::vector or std::string [cppcoreguidelines-no-malloc,hicpp-no-malloc]
      140 |   row->hl = reinterpret_cast<unsigned char*>(realloc(row->hl, static_cast<size_t>(row->rsize)));
          |                                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    /examples/kilo.cpp:140:46: warning: [cppcoreguidelines-owning-memory]

    calling legacy resource function without passing a 'gsl::owner<>'

      140 |   row->hl = reinterpret_cast<unsigned char*>(realloc(row->hl, static_cast<size_t>(row->rsize)));
          |                                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    /examples/kilo.cpp:140:46: warning: [misc-include-cleaner]

    no header providing "realloc" is directly included

       27 |   row->hl = reinterpret_cast<unsigned char*>(realloc(row->hl, static_cast<size_t>(row->rsize)));
          |                                              ^

    /examples/kilo.cpp:141:28: warning: [concurrency-mt-unsafe]

    function is not thread safe

      141 |   if(row->hl == nullptr) { exit(-1); /*TODO: better handler*/ }
          |                            ^

    /examples/kilo.cpp:141:28: warning: [misc-include-cleaner]

    no header providing "exit" is directly included

       27 |   if(row->hl == nullptr) { exit(-1); /*TODO: better handler*/ }
          |                            ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:144:23: warning: statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
      144 |   if(E.syntax.empty()) return;
          |                       ^       
          |                        {

    /examples/kilo.cpp:154:20: warning: [readability-implicit-bool-conversion]

    implicit conversion bool -> 'int'

      154 |   int in_comment = (row->idx > 0) && (E.row[row->idx - 1].hl_open_comment != 0);
          |                    ^                                                           
          |                    static_cast<int>(                                           )

    /examples/kilo.cpp:154:39: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      154 |   int in_comment = (row->idx > 0) && (E.row[row->idx - 1].hl_open_comment != 0);
          |                                       ^

    /examples/kilo.cpp:156:10: warning: [readability-identifier-length]

    variable name 'i' is too short, expected at least 3 characters

      156 |   size_t i = 0;
          |          ^

    /examples/kilo.cpp:157:9: warning: [altera-id-dependent-backward-branch]

    backward branch (while loop) is ID-dependent due to variable reference to 'i' and may cause performance degradation

      157 |   while(i < static_cast<size_t>(row->rsize))
          |         ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:156:3: note: inferred assignment of ID-dependent value from ID-dependent variable mce
      156 |   size_t i = 0;
          |   ^

    /examples/kilo.cpp:159:5: warning: [misc-const-correctness]

    variable 'c' of type 'char' can be declared 'const'

      159 |     char          c       = row->render[i];
          |     ^
          |                   const 

    /examples/kilo.cpp:159:19: warning: [readability-identifier-length]

    variable name 'c' is too short, expected at least 3 characters

      159 |     char          c       = row->render[i];
          |                   ^

    /examples/kilo.cpp:159:29: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      159 |     char          c       = row->render[i];
          |                             ^

    /examples/kilo.cpp:160:5: warning: [misc-const-correctness]

    variable 'prev_hl' of type 'unsigned char' can be declared 'const'

      160 |     unsigned char prev_hl = (i > 0) ? row->hl[i - 1] : static_cast<unsigned char>(HL_NORMAL);
          |     ^
          |                   const 

    /examples/kilo.cpp:160:39: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      160 |     unsigned char prev_hl = (i > 0) ? row->hl[i - 1] : static_cast<unsigned char>(HL_NORMAL);
          |                                       ^

    /examples/kilo.cpp:162:8: warning: [readability-container-size-empty]

    the 'empty' method should be used to check for emptiness instead of 'size'

      162 |     if(scs.size() && !in_string && !in_comment)
          |        ^~~~~~~~~~
          |        !scs.empty()
    /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/basic_string.h:1208:7: note: method 'basic_string<char>'::empty() defined here
     1208 |       empty() const _GLIBCXX_NOEXCEPT
          |       ^

    /examples/kilo.cpp:162:8: warning: [readability-implicit-bool-conversion]

    implicit conversion 'size_type' (aka 'unsigned long') -> bool

      162 |     if(scs.size() && !in_string && !in_comment)
          |        ^
          |        (          != 0u)

    /examples/kilo.cpp:162:23: warning: [readability-implicit-bool-conversion]

    implicit conversion 'int' -> bool

      162 |     if(scs.size() && !in_string && !in_comment)
          |                      ~^
          |                      (          == 0)

    /examples/kilo.cpp:162:37: warning: [readability-implicit-bool-conversion]

    implicit conversion 'int' -> bool

      162 |     if(scs.size() && !in_string && !in_comment)
          |                                    ~^         
          |                                    (           == 0)

    /examples/kilo.cpp:164:11: warning: [readability-implicit-bool-conversion]

    implicit conversion 'int' -> bool

      164 |       if(!strncmp(&row->render[i], &scs[0], scs.size()))
          |          ~^                                            
          |                                                         == 0

    /examples/kilo.cpp:164:20: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      164 |       if(!strncmp(&row->render[i], &scs[0], scs.size()))
          |                    ^

    /examples/kilo.cpp:164:36: warning: [readability-container-data-pointer]

    'data' should be used for accessing the data pointer instead of taking the address of the 0-th element

      164 |       if(!strncmp(&row->render[i], &scs[0], scs.size()))
          |                                    ^~~~~~~
          |                                    scs.data()

    /examples/kilo.cpp:166:17: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      166 |         memset(&row->hl[i], HL_COMMENT, row->rsize - i);
          |                 ^

    /examples/kilo.cpp:171:8: warning: [readability-container-size-empty]

    the 'empty' method should be used to check for emptiness instead of 'size'

      171 |     if(mcs.size() && mce.size() && !in_string)
          |        ^~~~~~~~~~
          |        !mcs.empty()
    /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/basic_string.h:1208:7: note: method 'basic_string<char>'::empty() defined here
     1208 |       empty() const _GLIBCXX_NOEXCEPT
          |       ^

    /examples/kilo.cpp:171:8: warning: [readability-implicit-bool-conversion]

    implicit conversion 'size_type' (aka 'unsigned long') -> bool

      171 |     if(mcs.size() && mce.size() && !in_string)
          |        ^
          |        (          != 0u)

    /examples/kilo.cpp:171:22: warning: [readability-container-size-empty]

    the 'empty' method should be used to check for emptiness instead of 'size'

      171 |     if(mcs.size() && mce.size() && !in_string)
          |                      ^~~~~~~~~~
          |                      !mce.empty()
    /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/basic_string.h:1208:7: note: method 'basic_string<char>'::empty() defined here
     1208 |       empty() const _GLIBCXX_NOEXCEPT
          |       ^

    /examples/kilo.cpp:171:22: warning: [readability-implicit-bool-conversion]

    implicit conversion 'size_type' (aka 'unsigned long') -> bool

      171 |     if(mcs.size() && mce.size() && !in_string)
          |                      ^
          |                      (          != 0u)

    /examples/kilo.cpp:171:37: warning: [readability-implicit-bool-conversion]

    implicit conversion 'int' -> bool

      171 |     if(mcs.size() && mce.size() && !in_string)
          |                                    ~^        
          |                                    (          == 0)

    /examples/kilo.cpp:173:10: warning: [readability-implicit-bool-conversion]

    implicit conversion 'int' -> bool

      173 |       if(in_comment)
          |          ^         
          |                     != 0

    /examples/kilo.cpp:175:9: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      175 |         row->hl[i] = HL_MLCOMMENT;
          |         ^

    /examples/kilo.cpp:176:13: warning: [readability-implicit-bool-conversion]

    implicit conversion 'int' -> bool

      176 |         if(!strncmp(&row->render[i], &mce[0], mce.size()))
          |            ~^                                            
          |                                                           == 0

    /examples/kilo.cpp:176:22: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      176 |         if(!strncmp(&row->render[i], &mce[0], mce.size()))
          |                      ^

    /examples/kilo.cpp:176:38: warning: [readability-container-data-pointer]

    'data' should be used for accessing the data pointer instead of taking the address of the 0-th element

      176 |         if(!strncmp(&row->render[i], &mce[0], mce.size()))
          |                                      ^~~~~~~
          |                                      mce.data()

    /examples/kilo.cpp:178:19: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      178 |           memset(&row->hl[i], HL_MLCOMMENT, mce.size());
          |                   ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:184:9: warning: do not use 'else' after 'continue' [llvm-else-after-return,readability-else-after-return]
      184 |         else
          |         ^~~~
      185 |         {
          |         ~
      186 |           i++;
          |           ~~~~
      187 |           continue;
          |           ~~~~~~~~~
      188 |         }
          |         ~

    /examples/kilo.cpp:190:16: warning: [readability-implicit-bool-conversion]

    implicit conversion 'int' -> bool

      190 |       else if(!strncmp(&row->render[i], &mcs[0], mcs.size()))
          |               ~^                                            
          |                                                              == 0

    /examples/kilo.cpp:190:25: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      190 |       else if(!strncmp(&row->render[i], &mcs[0], mcs.size()))
          |                         ^

    /examples/kilo.cpp:190:41: warning: [readability-container-data-pointer]

    'data' should be used for accessing the data pointer instead of taking the address of the 0-th element

      190 |       else if(!strncmp(&row->render[i], &mcs[0], mcs.size()))
          |                                         ^~~~~~~
          |                                         mcs.data()

    /examples/kilo.cpp:192:17: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      192 |         memset(&row->hl[i], HL_MLCOMMENT, mcs.size());
          |                 ^

    /examples/kilo.cpp:199:8: warning: [readability-implicit-bool-conversion]

    implicit conversion 'std::size_t' (aka 'unsigned long') -> bool

      199 |     if(E.syntax.flags & HL_HIGHLIGHT_STRINGS)
          |        ^                                    
          |        (                                    ) != 0u

    /examples/kilo.cpp:201:10: warning: [readability-implicit-bool-conversion]

    implicit conversion 'int' -> bool

      201 |       if(in_string)
          |          ^        
          |                    != 0

    /examples/kilo.cpp:203:9: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      203 |         row->hl[i] = HL_STRING;
          |         ^

    /examples/kilo.cpp:206:11: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      206 |           row->hl[i + 1] = HL_STRING;
          |           ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:210:27: warning: statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
      210 |         if(c == in_string) in_string = 0;
          |                           ^              
          |                            {
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:215:7: warning: do not use 'else' after 'continue' [llvm-else-after-return,readability-else-after-return]
      215 |       else
          |       ^~~~
      216 |       {
          |       ~
      217 |         if(c == '"' || c == '\'')
          |         ~~~~~~~~~~~~~~~~~~~~~~~~~
      218 |         {
          |         ~
      219 |           in_string  = c;
          |           ~~~~~~~~~~~~~~~
      220 |           row->hl[i] = HL_STRING;
          |           ~~~~~~~~~~~~~~~~~~~~~~~
      221 |           i++;
          |           ~~~~
      222 |           continue;
          |           ~~~~~~~~~
      223 |         }
          |         ~
      224 |       }
          |       ~
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:219:24: warning: 'signed char' to 'int' conversion; consider casting to 'unsigned char' first. [bugprone-signed-char-misuse,cert-str34-c]
      219 |           in_string  = c;
          |                        ^

    /examples/kilo.cpp:220:11: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      220 |           row->hl[i] = HL_STRING;
          |           ^

    /examples/kilo.cpp:227:8: warning: [readability-implicit-bool-conversion]

    implicit conversion 'std::size_t' (aka 'unsigned long') -> bool

      227 |     if(E.syntax.flags & HL_HIGHLIGHT_NUMBERS)
          |        ^                                    
          |        (                                    ) != 0u

    /examples/kilo.cpp:229:11: warning: [misc-include-cleaner]

    no header providing "isdigit" is directly included

       25 |       if((isdigit(c) && (prev_sep || prev_hl == HL_NUMBER)) || (c == '.' && prev_hl == HL_NUMBER))
          |           ^

    /examples/kilo.cpp:229:11: warning: [readability-implicit-bool-conversion]

    implicit conversion 'int' -> bool

      229 |       if((isdigit(c) && (prev_sep || prev_hl == HL_NUMBER)) || (c == '.' && prev_hl == HL_NUMBER))
          |           ^
          |           (          != 0)

    /examples/kilo.cpp:229:26: warning: [readability-implicit-bool-conversion]

    implicit conversion 'int' -> bool

      229 |       if((isdigit(c) && (prev_sep || prev_hl == HL_NUMBER)) || (c == '.' && prev_hl == HL_NUMBER))
          |                          ^
          |                          (        != 0)

    /examples/kilo.cpp:231:9: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      231 |         row->hl[i] = HL_NUMBER;
          |         ^

    /examples/kilo.cpp:238:8: warning: [readability-implicit-bool-conversion]

    implicit conversion 'int' -> bool

      238 |     if(prev_sep)
          |        ^       
          |                 != 0

    /examples/kilo.cpp:240:11: warning: [cppcoreguidelines-init-variables]

    variable 'j' is not initialized

      240 |       int j;
          |           ^
          |             = 0

    /examples/kilo.cpp:240:11: warning: [readability-identifier-length]

    variable name 'j' is too short, expected at least 3 characters

    /examples/kilo.cpp:241:18: warning: [altera-id-dependent-backward-branch]

    backward branch (for loop) is ID-dependent due to variable reference to 'keywords' and may cause performance degradation

      241 |       for(j = 0; keywords[j]; j++)
          |                  ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:146:3: note: inferred assignment of ID-dependent value from ID-dependent member keywords
      146 |   const char** keywords = E.syntax.keywords;
          |   ^

    /examples/kilo.cpp:241:18: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      241 |       for(j = 0; keywords[j]; j++)
          |                  ^

    /examples/kilo.cpp:241:18: warning: [readability-implicit-bool-conversion]

    implicit conversion 'const char *' -> bool

      241 |       for(j = 0; keywords[j]; j++)
          |                  ^          
          |                              != nullptr

    /examples/kilo.cpp:243:44: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      243 |         int klen = static_cast<int>(strlen(keywords[j]));
          |                                            ^

    /examples/kilo.cpp:244:9: warning: [misc-const-correctness]

    variable 'kw2' of type 'int' can be declared 'const'

      244 |         int kw2  = keywords[j][klen - 1] == '|';
          |         ^
          |             const 

    /examples/kilo.cpp:244:20: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      244 |         int kw2  = keywords[j][klen - 1] == '|';
          |                    ^

    /examples/kilo.cpp:244:20: warning: [readability-implicit-bool-conversion]

    implicit conversion bool -> 'int'

      244 |         int kw2  = keywords[j][klen - 1] == '|';
          |                    ^                           
          |                    static_cast<int>(           )

    /examples/kilo.cpp:245:12: warning: [readability-implicit-bool-conversion]

    implicit conversion 'int' -> bool

      245 |         if(kw2) klen--;
          |            ^  
          |                != 0
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:245:16: warning: statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
      245 |         if(kw2) klen--;
          |                ^       
          |                 {

    /examples/kilo.cpp:247:13: warning: [readability-implicit-bool-conversion]

    implicit conversion 'int' -> bool

      247 |         if(!strncmp(&row->render[i], keywords[j], klen) && is_separator(row->render[i + klen]))
          |            ~^
          |            (                                            == 0)

    /examples/kilo.cpp:247:22: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      247 |         if(!strncmp(&row->render[i], keywords[j], klen) && is_separator(row->render[i + klen]))
          |                      ^

    /examples/kilo.cpp:247:38: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      247 |         if(!strncmp(&row->render[i], keywords[j], klen) && is_separator(row->render[i + klen]))
          |                                      ^

    /examples/kilo.cpp:247:73: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      247 |         if(!strncmp(&row->render[i], keywords[j], klen) && is_separator(row->render[i + klen]))
          |                                                                         ^

    /examples/kilo.cpp:249:19: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      249 |           memset(&row->hl[i], kw2 ? HL_KEYWORD2 : HL_KEYWORD1, static_cast<size_t>(klen));
          |                   ^

    /examples/kilo.cpp:249:31: warning: [readability-implicit-bool-conversion]

    implicit conversion 'int' -> bool

      249 |           memset(&row->hl[i], kw2 ? HL_KEYWORD2 : HL_KEYWORD1, static_cast<size_t>(klen));
          |                               ^
          |                                   != 0

    /examples/kilo.cpp:254:10: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      254 |       if(keywords[j] != nullptr)
          |          ^

    /examples/kilo.cpp:261:16: warning: [readability-implicit-bool-conversion]

    implicit conversion bool -> 'int'

      261 |     prev_sep = is_separator(c);
          |                ^              
          |                static_cast<int>( )

    /examples/kilo.cpp:265:3: warning: [misc-const-correctness]

    variable 'changed' of type 'int' can be declared 'const'

      265 |   int changed          = (row->hl_open_comment != in_comment);
          |   ^
          |       const 

    /examples/kilo.cpp:265:26: warning: [readability-implicit-bool-conversion]

    implicit conversion bool -> 'int'

      265 |   int changed          = (row->hl_open_comment != in_comment);
          |                          ^
          |                          static_cast<int>

    /examples/kilo.cpp:267:6: warning: [readability-implicit-bool-conversion]

    implicit conversion 'int' -> bool

      267 |   if(changed && row->idx + 1 < E.numrows) editorUpdateSyntax(&E.row[row->idx + 1]);
          |      ^
          |      (       != 0)

    /examples/kilo.cpp:267:30: warning: [clang-diagnostic-sign-compare]

    comparison of integers of different signs: 'int' and 'std::size_t' (aka 'unsigned long')

      267 |   if(changed && row->idx + 1 < E.numrows) editorUpdateSyntax(&E.row[row->idx + 1]);
          |                 ~~~~~~~~~~~~ ^ ~~~~~~~~~
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:267:42: warning: statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
      267 |   if(changed && row->idx + 1 < E.numrows) editorUpdateSyntax(&E.row[row->idx + 1]);
          |                                          ^                                         
          |                                           {

    /examples/kilo.cpp:267:63: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      267 |   if(changed && row->idx + 1 < E.numrows) editorUpdateSyntax(&E.row[row->idx + 1]);
          |                                                               ^

    /examples/kilo.cpp:292:3: warning: [modernize-loop-convert]

    use range-based for loop instead

      292 |   for(std::size_t j = 0; j != HLDB.size(); ++j)
          |   ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          |      (auto & j : HLDB)
      293 |   {
      294 |     for(std::size_t i = 0; i != HLDB[j].filematch.size(); ++i)
          |                                 ~~~~~~~
          |                                 j
      295 |     {
      296 |       if(HLDB[j].filematch[i] == ext)
          |          ~~~~~~~
          |          j
      297 |       {
      298 |         E.syntax = HLDB[j];
          |                    ~~~~~~~
          |                    j

    /examples/kilo.cpp:294:33: warning: [cppcoreguidelines-pro-bounds-constant-array-index]

    do not use array subscript when the index is not an integer constant expression

      294 |     for(std::size_t i = 0; i != HLDB[j].filematch.size(); ++i)
          |                                 ^

    /examples/kilo.cpp:296:10: warning: [cppcoreguidelines-pro-bounds-constant-array-index]

    do not use array subscript when the index is not an integer constant expression

      296 |       if(HLDB[j].filematch[i] == ext)
          |          ^

    /examples/kilo.cpp:298:20: warning: [cppcoreguidelines-pro-bounds-constant-array-index]

    do not use array subscript when the index is not an integer constant expression

      298 |         E.syntax = HLDB[j];
          |                    ^

    /examples/kilo.cpp:299:92: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      299 |         for(std::size_t filerow = 0; filerow < E.numrows; filerow++) { editorUpdateSyntax(&E.row[filerow]); }
          |                                                                                            ^

    /examples/kilo.cpp:308:36: warning: [readability-identifier-length]

    parameter name 'cx' is too short, expected at least 3 characters

      308 | int editorRowCxToRx(erow* row, int cx)
          |                                    ^

    /examples/kilo.cpp:310:7: warning: [readability-identifier-length]

    variable name 'rx' is too short, expected at least 3 characters

      310 |   int rx = 0;
          |       ^

    /examples/kilo.cpp:311:28: warning: [clang-diagnostic-sign-compare]

    comparison of integers of different signs: 'std::size_t' (aka 'unsigned long') and 'int'

      311 |   for(std::size_t j = 0; j < cx; ++j)
          |                          ~ ^ ~~

    /examples/kilo.cpp:313:8: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      313 |     if(row->chars[j] == '\t') { rx += (KILO_TAB_STOP - 1) - (rx % KILO_TAB_STOP); }
          |        ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:313:39: warning: narrowing conversion from 'std::size_t' (aka 'unsigned long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]
      313 |     if(row->chars[j] == '\t') { rx += (KILO_TAB_STOP - 1) - (rx % KILO_TAB_STOP); }
          |                                       ^

    /examples/kilo.cpp:319:36: warning: [readability-identifier-length]

    parameter name 'rx' is too short, expected at least 3 characters

      319 | int editorRowRxToCx(erow* row, int rx)
          |                                    ^

    /examples/kilo.cpp:322:7: warning: [readability-identifier-length]

    variable name 'cx' is too short, expected at least 3 characters

      322 |   int cx{};
          |       ^

    /examples/kilo.cpp:325:8: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      325 |     if(row->chars[cx] == '\t') cur_rx += (KILO_TAB_STOP - 1) - (cur_rx % KILO_TAB_STOP);
          |        ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:325:31: warning: statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
      325 |     if(row->chars[cx] == '\t') cur_rx += (KILO_TAB_STOP - 1) - (cur_rx % KILO_TAB_STOP);
          |                               ^                                                         
          |                                {
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:325:42: warning: narrowing conversion from 'std::size_t' (aka 'unsigned long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]
      325 |     if(row->chars[cx] == '\t') cur_rx += (KILO_TAB_STOP - 1) - (cur_rx % KILO_TAB_STOP);
          |                                          ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:328:20: warning: statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
      328 |     if(cur_rx > rx) return cx;
          |                    ^          
          |                     {
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:336:37: warning: statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
      336 |   for(int j = 0; j < row->size; j++)
          |                                     ^
          |                                      {
      337 |     if(row->chars[j] == '\t') tabs++;
          |                                      

    /examples/kilo.cpp:337:8: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      337 |     if(row->chars[j] == '\t') tabs++;
          |        ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:337:30: warning: statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
      337 |     if(row->chars[j] == '\t') tabs++;
          |                              ^       
          |                               {
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:339:3: warning: do not manage memory manually; use RAII [cppcoreguidelines-no-malloc,hicpp-no-malloc]
      339 |   free(row->render);
          |   ^~~~~~~~~~~~~~~~~

    /examples/kilo.cpp:339:3: warning: [cppcoreguidelines-owning-memory]

    calling legacy resource function without passing a 'gsl::owner<>'

      339 |   free(row->render);
          |   ^~~~~~~~~~~~~~~~~

    /examples/kilo.cpp:339:3: warning: [misc-include-cleaner]

    no header providing "free" is directly included

       27 |   free(row->render);
          |   ^

    /examples/kilo.cpp:340:3: warning: [cppcoreguidelines-owning-memory]

    assigning newly created 'gsl::owner<>' to non-owner 'char *'

      340 |   row->render = reinterpret_cast<char*>(malloc(static_cast<size_t>(row->size + tabs * (KILO_TAB_STOP - 1) + 1)));
          |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    /examples/kilo.cpp:340:17: warning: [cppcoreguidelines-pro-type-reinterpret-cast]

    do not use reinterpret_cast

      340 |   row->render = reinterpret_cast<char*>(malloc(static_cast<size_t>(row->size + tabs * (KILO_TAB_STOP - 1) + 1)));
          |                 ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:340:41: warning: do not manage memory manually; consider a container or a smart pointer [cppcoreguidelines-no-malloc,hicpp-no-malloc]
      340 |   row->render = reinterpret_cast<char*>(malloc(static_cast<size_t>(row->size + tabs * (KILO_TAB_STOP - 1) + 1)));
          |                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    /examples/kilo.cpp:340:41: warning: [misc-include-cleaner]

    no header providing "malloc" is directly included

       27 |   row->render = reinterpret_cast<char*>(malloc(static_cast<size_t>(row->size + tabs * (KILO_TAB_STOP - 1) + 1)));
          |                                         ^

    /examples/kilo.cpp:341:32: warning: [concurrency-mt-unsafe]

    function is not thread safe

      341 |   if(row->render == nullptr) { exit(-1); /*TODO: create better check*/ }
          |                                ^

    /examples/kilo.cpp:341:32: warning: [misc-include-cleaner]

    no header providing "exit" is directly included

       27 |   if(row->render == nullptr) { exit(-1); /*TODO: create better check*/ }
          |                                ^

    /examples/kilo.cpp:346:8: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      346 |     if(row->chars[j] == '\t')
          |        ^

    /examples/kilo.cpp:348:7: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      348 |       row->render[idx++] = ' ';
          |       ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:349:38: warning: statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
      349 |       while(idx % KILO_TAB_STOP != 0) row->render[idx++] = ' ';
          |                                      ^                         
          |                                       {

    /examples/kilo.cpp:349:39: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      349 |       while(idx % KILO_TAB_STOP != 0) row->render[idx++] = ' ';
          |                                       ^

    /examples/kilo.cpp:351:12: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      351 |     else { row->render[idx++] = row->chars[j]; }
          |            ^

    /examples/kilo.cpp:351:33: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      351 |     else { row->render[idx++] = row->chars[j]; }
          |                                 ^

    /examples/kilo.cpp:353:3: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      353 |   row->render[idx] = '\0';
          |   ^

    /examples/kilo.cpp:359:26: warning: [readability-identifier-length]

    parameter name 'at' is too short, expected at least 3 characters

      359 | void editorInsertRow(int at, const char* s, std::size_t len)
          |                          ^

    /examples/kilo.cpp:359:42: warning: [readability-identifier-length]

    parameter name 's' is too short, expected at least 3 characters

      359 | void editorInsertRow(int at, const char* s, std::size_t len)
          |                                          ^

    /examples/kilo.cpp:361:19: warning: [clang-diagnostic-sign-compare]

    comparison of integers of different signs: 'int' and 'std::size_t' (aka 'unsigned long')

      361 |   if(at < 0 || at > E.numrows) return;
          |                ~~ ^ ~~~~~~~~~
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:361:31: warning: statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
      361 |   if(at < 0 || at > E.numrows) return;
          |                               ^       
          |                                {

    /examples/kilo.cpp:363:3: warning: [cppcoreguidelines-owning-memory]

    assigning newly created 'gsl::owner<>' to non-owner 'erow *'

      363 |   E.row = reinterpret_cast<erow*>(realloc(E.row, sizeof(erow) * (static_cast<size_t>(E.numrows) + 1)));
          |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    /examples/kilo.cpp:363:11: warning: [cppcoreguidelines-pro-type-reinterpret-cast]

    do not use reinterpret_cast

      363 |   E.row = reinterpret_cast<erow*>(realloc(E.row, sizeof(erow) * (static_cast<size_t>(E.numrows) + 1)));
          |           ^

    /examples/kilo.cpp:363:35: warning: [bugprone-suspicious-realloc-usage]

    'E.row' may be set to null if 'realloc' fails, which may result in a leak of the original buffer

      363 |   E.row = reinterpret_cast<erow*>(realloc(E.row, sizeof(erow) * (static_cast<size_t>(E.numrows) + 1)));
          |   ~~~~~                           ^       ~~~~~
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:363:35: warning: do not manage memory manually; consider std::vector or std::string [cppcoreguidelines-no-malloc,hicpp-no-malloc]
      363 |   E.row = reinterpret_cast<erow*>(realloc(E.row, sizeof(erow) * (static_cast<size_t>(E.numrows) + 1)));
          |                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    /examples/kilo.cpp:363:35: warning: [cppcoreguidelines-owning-memory]

    calling legacy resource function without passing a 'gsl::owner<>'

      363 |   E.row = reinterpret_cast<erow*>(realloc(E.row, sizeof(erow) * (static_cast<size_t>(E.numrows) + 1)));
          |                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    /examples/kilo.cpp:363:35: warning: [misc-include-cleaner]

    no header providing "realloc" is directly included

       27 |   E.row = reinterpret_cast<erow*>(realloc(E.row, sizeof(erow) * (static_cast<size_t>(E.numrows) + 1)));
          |                                   ^

    /examples/kilo.cpp:364:26: warning: [concurrency-mt-unsafe]

    function is not thread safe

      364 |   if(E.row == nullptr) { exit(-1); /*TODO: create better check*/ }
          |                          ^

    /examples/kilo.cpp:364:26: warning: [misc-include-cleaner]

    no header providing "exit" is directly included

       27 |   if(E.row == nullptr) { exit(-1); /*TODO: create better check*/ }
          |                          ^

    /examples/kilo.cpp:365:12: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      365 |   memmove(&E.row[at + 1], &E.row[at], sizeof(erow) * (static_cast<size_t>(E.numrows) - at));
          |            ^

    /examples/kilo.cpp:365:28: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      365 |   memmove(&E.row[at + 1], &E.row[at], sizeof(erow) * (static_cast<size_t>(E.numrows) - at));
          |                            ^

    /examples/kilo.cpp:366:23: warning: [altera-id-dependent-backward-branch]

    backward branch (for loop) is ID-dependent due to variable reference to 'j' and may cause performance degradation

      366 |   for(int j = at + 1; j <= E.numrows; j++) E.row[j].idx++;
          |                       ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:366:7: note: inferred assignment of ID-dependent value from ID-dependent 
      366 |   for(int j = at + 1; j <= E.numrows; j++) E.row[j].idx++;
          |       ^

    /examples/kilo.cpp:366:25: warning: [clang-diagnostic-sign-compare]

    comparison of integers of different signs: 'int' and 'std::size_t' (aka 'unsigned long')

      366 |   for(int j = at + 1; j <= E.numrows; j++) E.row[j].idx++;
          |                       ~ ^  ~~~~~~~~~
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:366:43: warning: statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
      366 |   for(int j = at + 1; j <= E.numrows; j++) E.row[j].idx++;
          |                                           ^               
          |                                            {

    /examples/kilo.cpp:366:44: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      366 |   for(int j = at + 1; j <= E.numrows; j++) E.row[j].idx++;
          |                                            ^

    /examples/kilo.cpp:368:3: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      368 |   E.row[at].idx = at;
          |   ^

    /examples/kilo.cpp:370:3: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      370 |   E.row[at].size  = static_cast<int>(len);
          |   ^

    /examples/kilo.cpp:371:3: warning: [cppcoreguidelines-owning-memory]

    assigning newly created 'gsl::owner<>' to non-owner 'char *'

      371 |   E.row[at].chars = (char*)malloc(len + 1);
          |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    /examples/kilo.cpp:371:3: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

    /examples/kilo.cpp:371:21: warning: [cppcoreguidelines-pro-type-cstyle-cast]

    do not use C-style cast to convert between unrelated types

      371 |   E.row[at].chars = (char*)malloc(len + 1);
          |                     ^

    /examples/kilo.cpp:371:21: warning: [google-readability-casting]

    C-style casts are discouraged; use static_cast

      371 |   E.row[at].chars = (char*)malloc(len + 1);
          |                     ^~~~~~~               
          |                     static_cast<char*>(   )
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:371:28: warning: do not manage memory manually; consider a container or a smart pointer [cppcoreguidelines-no-malloc,hicpp-no-malloc]
      371 |   E.row[at].chars = (char*)malloc(len + 1);
          |                            ^~~~~~~~~~~~~~~

    /examples/kilo.cpp:371:28: warning: [misc-include-cleaner]

    no header providing "malloc" is directly included

       27 |   E.row[at].chars = (char*)malloc(len + 1);
          |                            ^

    /examples/kilo.cpp:372:6: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      372 |   if(E.row[at].chars == nullptr)
          |      ^

    /examples/kilo.cpp:375:5: warning: [concurrency-mt-unsafe]

    function is not thread safe

      375 |     exit(-1);  // insert better error handling if needed
          |     ^

    /examples/kilo.cpp:375:5: warning: [misc-include-cleaner]

    no header providing "exit" is directly included

       27 |     exit(-1);  // insert better error handling if needed
          |     ^

    /examples/kilo.cpp:377:10: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      377 |   memcpy(E.row[at].chars, s, len);
          |          ^

    /examples/kilo.cpp:378:3: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      378 |   E.row[at].chars[len] = '\0';
          |   ^

    /examples/kilo.cpp:380:3: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      380 |   E.row[at].rsize           = 0;
          |   ^

    /examples/kilo.cpp:381:3: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      381 |   E.row[at].render          = nullptr;
          |   ^

    /examples/kilo.cpp:382:3: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      382 |   E.row[at].hl              = nullptr;
          |   ^

    /examples/kilo.cpp:383:3: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      383 |   E.row[at].hl_open_comment = 0;
          |   ^

    /examples/kilo.cpp:384:20: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      384 |   editorUpdateRow(&E.row[at]);
          |                    ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:392:3: warning: do not manage memory manually; use RAII [cppcoreguidelines-no-malloc,hicpp-no-malloc]
      392 |   free(row->render);
          |   ^~~~~~~~~~~~~~~~~

    /examples/kilo.cpp:392:3: warning: [cppcoreguidelines-owning-memory]

    calling legacy resource function without passing a 'gsl::owner<>'

      392 |   free(row->render);
          |   ^~~~~~~~~~~~~~~~~

    /examples/kilo.cpp:392:3: warning: [misc-include-cleaner]

    no header providing "free" is directly included

       27 |   free(row->render);
          |   ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:393:3: warning: do not manage memory manually; use RAII [cppcoreguidelines-no-malloc,hicpp-no-malloc]
      393 |   free(row->chars);
          |   ^~~~~~~~~~~~~~~~

    /examples/kilo.cpp:393:3: warning: [cppcoreguidelines-owning-memory]

    calling legacy resource function without passing a 'gsl::owner<>'

      393 |   free(row->chars);
          |   ^~~~~~~~~~~~~~~~

    /examples/kilo.cpp:393:3: warning: [misc-include-cleaner]

    no header providing "free" is directly included

       27 |   free(row->chars);
          |   ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:394:3: warning: do not manage memory manually; use RAII [cppcoreguidelines-no-malloc,hicpp-no-malloc]
      394 |   free(row->hl);
          |   ^~~~~~~~~~~~~

    /examples/kilo.cpp:394:3: warning: [cppcoreguidelines-owning-memory]

    calling legacy resource function without passing a 'gsl::owner<>'

      394 |   free(row->hl);
          |   ^~~~~~~~~~~~~

    /examples/kilo.cpp:394:3: warning: [misc-include-cleaner]

    no header providing "free" is directly included

       27 |   free(row->hl);
          |   ^

    /examples/kilo.cpp:397:23: warning: [readability-identifier-length]

    parameter name 'at' is too short, expected at least 3 characters

      397 | void editorDelRow(int at)
          |                       ^

    /examples/kilo.cpp:399:19: warning: [clang-diagnostic-sign-compare]

    comparison of integers of different signs: 'int' and 'std::size_t' (aka 'unsigned long')

      399 |   if(at < 0 || at >= E.numrows) return;
          |                ~~ ^  ~~~~~~~~~
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:399:32: warning: statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
      399 |   if(at < 0 || at >= E.numrows) return;
          |                                ^       
          |                                 {

    /examples/kilo.cpp:400:18: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      400 |   editorFreeRow(&E.row[at]);
          |                  ^

    /examples/kilo.cpp:401:12: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      401 |   memmove(&E.row[at], &E.row[at + 1], sizeof(erow) * (static_cast<size_t>(E.numrows) - at - 1));
          |            ^

    /examples/kilo.cpp:401:24: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      401 |   memmove(&E.row[at], &E.row[at + 1], sizeof(erow) * (static_cast<size_t>(E.numrows) - at - 1));
          |                        ^

    /examples/kilo.cpp:402:19: warning: [altera-id-dependent-backward-branch]

    backward branch (for loop) is ID-dependent due to variable reference to 'j' and may cause performance degradation

      402 |   for(int j = at; j < E.numrows - 1; j++) E.row[j].idx--;
          |                   ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:402:7: note: inferred assignment of ID-dependent value from ID-dependent 
      402 |   for(int j = at; j < E.numrows - 1; j++) E.row[j].idx--;
          |       ^

    /examples/kilo.cpp:402:21: warning: [clang-diagnostic-sign-compare]

    comparison of integers of different signs: 'int' and 'std::size_t' (aka 'unsigned long')

      402 |   for(int j = at; j < E.numrows - 1; j++) E.row[j].idx--;
          |                   ~ ^ ~~~~~~~~~~~~~
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:402:42: warning: statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
      402 |   for(int j = at; j < E.numrows - 1; j++) E.row[j].idx--;
          |                                          ^               
          |                                           {

    /examples/kilo.cpp:402:43: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      402 |   for(int j = at; j < E.numrows - 1; j++) E.row[j].idx--;
          |                                           ^

    /examples/kilo.cpp:407:41: warning: [readability-identifier-length]

    parameter name 'at' is too short, expected at least 3 characters

      407 | void editorRowInsertChar(erow* row, int at, int c)
          |                                         ^

    /examples/kilo.cpp:407:49: warning: [readability-identifier-length]

    parameter name 'c' is too short, expected at least 3 characters

      407 | void editorRowInsertChar(erow* row, int at, int c)
          |                                                 ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:409:31: warning: statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
      409 |   if(at < 0 || at > row->size) at = row->size;
          |                               ^               
          |                                {

    /examples/kilo.cpp:410:3: warning: [cppcoreguidelines-owning-memory]

    assigning newly created 'gsl::owner<>' to non-owner 'char *'

      410 |   row->chars = reinterpret_cast<char*>(realloc(row->chars, static_cast<size_t>(row->size) + 2));
          |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    /examples/kilo.cpp:410:16: warning: [cppcoreguidelines-pro-type-reinterpret-cast]

    do not use reinterpret_cast

      410 |   row->chars = reinterpret_cast<char*>(realloc(row->chars, static_cast<size_t>(row->size) + 2));
          |                ^

    /examples/kilo.cpp:410:40: warning: [bugprone-suspicious-realloc-usage]

    'row->chars' may be set to null if 'realloc' fails, which may result in a leak of the original buffer

      410 |   row->chars = reinterpret_cast<char*>(realloc(row->chars, static_cast<size_t>(row->size) + 2));
          |   ~~~~~~~~~~                           ^       ~~~~~~~~~~
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:410:40: warning: do not manage memory manually; consider std::vector or std::string [cppcoreguidelines-no-malloc,hicpp-no-malloc]
      410 |   row->chars = reinterpret_cast<char*>(realloc(row->chars, static_cast<size_t>(row->size) + 2));
          |                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    /examples/kilo.cpp:410:40: warning: [cppcoreguidelines-owning-memory]

    calling legacy resource function without passing a 'gsl::owner<>'

      410 |   row->chars = reinterpret_cast<char*>(realloc(row->chars, static_cast<size_t>(row->size) + 2));
          |                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    /examples/kilo.cpp:410:40: warning: [misc-include-cleaner]

    no header providing "realloc" is directly included

       27 |   row->chars = reinterpret_cast<char*>(realloc(row->chars, static_cast<size_t>(row->size) + 2));
          |                                        ^

    /examples/kilo.cpp:411:31: warning: [concurrency-mt-unsafe]

    function is not thread safe

      411 |   if(row->chars == nullptr) { exit(-1); /*TODO: create better check*/ }
          |                               ^

    /examples/kilo.cpp:411:31: warning: [misc-include-cleaner]

    no header providing "exit" is directly included

       27 |   if(row->chars == nullptr) { exit(-1); /*TODO: create better check*/ }
          |                               ^

    /examples/kilo.cpp:412:12: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      412 |   memmove(&row->chars[at + 1], &row->chars[at], static_cast<size_t>(row->size) - at + 1);
          |            ^

    /examples/kilo.cpp:412:33: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      412 |   memmove(&row->chars[at + 1], &row->chars[at], static_cast<size_t>(row->size) - at + 1);
          |                                 ^

    /examples/kilo.cpp:414:3: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      414 |   row->chars[at] = static_cast<char>(c);
          |   ^

    /examples/kilo.cpp:419:45: warning: [readability-identifier-length]

    parameter name 's' is too short, expected at least 3 characters

      419 | void editorRowAppendString(erow* row, char* s, std::size_t len)
          |                                             ^

    /examples/kilo.cpp:421:3: warning: [cppcoreguidelines-owning-memory]

    assigning newly created 'gsl::owner<>' to non-owner 'char *'

      421 |   row->chars = reinterpret_cast<char*>(realloc(row->chars, static_cast<size_t>(row->size) + len + 1));
          |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    /examples/kilo.cpp:421:16: warning: [cppcoreguidelines-pro-type-reinterpret-cast]

    do not use reinterpret_cast

      421 |   row->chars = reinterpret_cast<char*>(realloc(row->chars, static_cast<size_t>(row->size) + len + 1));
          |                ^

    /examples/kilo.cpp:421:40: warning: [bugprone-suspicious-realloc-usage]

    'row->chars' may be set to null if 'realloc' fails, which may result in a leak of the original buffer

      421 |   row->chars = reinterpret_cast<char*>(realloc(row->chars, static_cast<size_t>(row->size) + len + 1));
          |   ~~~~~~~~~~                           ^       ~~~~~~~~~~
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:421:40: warning: do not manage memory manually; consider std::vector or std::string [cppcoreguidelines-no-malloc,hicpp-no-malloc]
      421 |   row->chars = reinterpret_cast<char*>(realloc(row->chars, static_cast<size_t>(row->size) + len + 1));
          |                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    /examples/kilo.cpp:421:40: warning: [cppcoreguidelines-owning-memory]

    calling legacy resource function without passing a 'gsl::owner<>'

      421 |   row->chars = reinterpret_cast<char*>(realloc(row->chars, static_cast<size_t>(row->size) + len + 1));
          |                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    /examples/kilo.cpp:421:40: warning: [misc-include-cleaner]

    no header providing "realloc" is directly included

       27 |   row->chars = reinterpret_cast<char*>(realloc(row->chars, static_cast<size_t>(row->size) + len + 1));
          |                                        ^

    /examples/kilo.cpp:422:31: warning: [concurrency-mt-unsafe]

    function is not thread safe

      422 |   if(row->chars == nullptr) { exit(-1); /*TODO: create better check*/ }
          |                               ^

    /examples/kilo.cpp:422:31: warning: [misc-include-cleaner]

    no header providing "exit" is directly included

       27 |   if(row->chars == nullptr) { exit(-1); /*TODO: create better check*/ }
          |                               ^

    /examples/kilo.cpp:423:11: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      423 |   memcpy(&row->chars[row->size], s, len);
          |           ^

    /examples/kilo.cpp:425:3: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      425 |   row->chars[row->size] = '\0';
          |   ^

    /examples/kilo.cpp:430:38: warning: [readability-identifier-length]

    parameter name 'at' is too short, expected at least 3 characters

      430 | void editorRowDelChar(erow* row, int at)
          |                                      ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:432:32: warning: statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
      432 |   if(at < 0 || at >= row->size) return;
          |                                ^       
          |                                 {

    /examples/kilo.cpp:433:12: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      433 |   memmove(&row->chars[at], &row->chars[at + 1], static_cast<size_t>(row->size) - at);
          |            ^

    /examples/kilo.cpp:433:29: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      433 |   memmove(&row->chars[at], &row->chars[at + 1], static_cast<size_t>(row->size) - at);
          |                             ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:443:43: warning: narrowing conversion from 'std::size_t' (aka 'unsigned long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]
      443 |   if(E.cy == E.numrows) { editorInsertRow(E.numrows, "", 0); }
          |                                           ^

    /examples/kilo.cpp:444:24: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      444 |   editorRowInsertChar(&E.row[E.cy], E.cx, key);
          |                        ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:444:37: warning: narrowing conversion from 'std::size_t' (aka 'unsigned long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]
      444 |   editorRowInsertChar(&E.row[E.cy], E.cx, key);
          |                                     ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:450:35: warning: narrowing conversion from 'std::size_t' (aka 'unsigned long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]
      450 |   if(E.cx == 0) { editorInsertRow(E.cy, "", 0); }
          |                                   ^

    /examples/kilo.cpp:453:18: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      453 |     erow* row = &E.row[E.cy];
          |                  ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:454:21: warning: narrowing conversion from 'std::size_t' (aka 'unsigned long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]
      454 |     editorInsertRow(E.cy + 1, &row->chars[E.cx], static_cast<size_t>(row->size - E.cx));
          |                     ^

    /examples/kilo.cpp:454:32: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      454 |     editorInsertRow(E.cy + 1, &row->chars[E.cx], static_cast<size_t>(row->size - E.cx));
          |                                ^

    /examples/kilo.cpp:455:30: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      455 |     row                   = &E.row[E.cy];
          |                              ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:456:29: warning: narrowing conversion from 'std::size_t' (aka 'unsigned long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]
      456 |     row->size             = E.cx;
          |                             ^

    /examples/kilo.cpp:457:5: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      457 |     row->chars[row->size] = '\0';
          |     ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:466:24: warning: statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
      466 |   if(E.cy == E.numrows) return;
          |                        ^       
          |                         {
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:467:29: warning: statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
      467 |   if(E.cx == 0 && E.cy == 0) return;
          |                             ^       
          |                              {

    /examples/kilo.cpp:469:16: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      469 |   erow* row = &E.row[E.cy];
          |                ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:472:27: warning: narrowing conversion from 'std::size_t' (aka 'unsigned long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]
      472 |     editorRowDelChar(row, E.cx - 1);
          |                           ^

    /examples/kilo.cpp:477:12: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      477 |     E.cx = E.row[E.cy - 1].size;
          |            ^

    /examples/kilo.cpp:478:28: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      478 |     editorRowAppendString(&E.row[E.cy - 1], row->chars, static_cast<size_t>(row->size));
          |                            ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:479:18: warning: narrowing conversion from 'std::size_t' (aka 'unsigned long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]
      479 |     editorDelRow(E.cy);
          |                  ^

    /examples/kilo.cpp:489:76: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      489 |   for(std::size_t line = 0; line < E.numrows; ++line) { ret += std::string(E.row[line].chars, static_cast<std::size_t>(E.row[line].size)) + '\n'; }
          |                                                                            ^

    /examples/kilo.cpp:489:120: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      489 |   for(std::size_t line = 0; line < E.numrows; ++line) { ret += std::string(E.row[line].chars, static_cast<std::size_t>(E.row[line].size)) + '\n'; }
          |                                                                                                                        ^

    /examples/kilo.cpp:499:32: warning: [misc-include-cleaner]

    no header providing "std::runtime_error" is directly included

       30 |   if(file.fail()) { throw std::runtime_error("File failed to open."); }
          |                                ^

    /examples/kilo.cpp:502:9: warning: [altera-id-dependent-backward-branch]

    backward branch (while loop) is ID-dependent due to variable reference to 'file' and may cause performance degradation

      502 |   while(file.rdstate() == std::ios_base::goodbit)
          |         ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:498:3: note: inferred assignment of ID-dependent value from ID-dependent 
      498 |   std::ifstream file(E.filename);
          |   ^

    /examples/kilo.cpp:504:5: warning: [google-runtime-int]

    consider replacing 'long' with 'int64'

      504 |     long linelen = static_cast<long>(line.size());
          |     ^

    /examples/kilo.cpp:504:32: warning: [google-runtime-int]

    consider replacing 'long' with 'int64'

      504 |     long linelen = static_cast<long>(line.size());
          |                                ^

    /examples/kilo.cpp:505:11: warning: [altera-id-dependent-backward-branch]

    backward branch (while loop) is ID-dependent due to variable reference to 'linelen' and may cause performance degradation

      505 |     while(linelen > 0 && (line[static_cast<size_t>(linelen - 1)] == '\n' || line[static_cast<size_t>(linelen - 1)] == '\r')) linelen--;
          |           ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:504:5: note: inferred assignment of ID-dependent value from ID-dependent 
      504 |     long linelen = static_cast<long>(line.size());
          |     ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:505:125: warning: statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
      505 |     while(linelen > 0 && (line[static_cast<size_t>(linelen - 1)] == '\n' || line[static_cast<size_t>(linelen - 1)] == '\r')) linelen--;
          |                                                                                                                             ^          
          |                                                                                                                              {
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:506:21: warning: narrowing conversion from 'std::size_t' (aka 'unsigned long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]
      506 |     editorInsertRow(E.numrows, line.c_str(), linelen);
          |                     ^

    /examples/kilo.cpp:512:6: warning: [cert-dcl50-cpp]

    do not define a C-style variadic function; consider using a function parameter pack or currying instead

      512 | void editorSetStatusMessage(const std::string fmt, ...)
          |      ^

    /examples/kilo.cpp:512:47: warning: [performance-unnecessary-value-param]

    the const qualified parameter 'fmt' is copied for each invocation; consider making it a reference

      512 | void editorSetStatusMessage(const std::string fmt, ...)
          |                                               ^
          |                                              &
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:514:3: warning: do not declare variables of type va_list; use variadic templates instead [cppcoreguidelines-pro-type-vararg,hicpp-vararg]
      514 |   va_list ap;
          |   ^

    /examples/kilo.cpp:514:11: warning: [readability-identifier-length]

    variable name 'ap' is too short, expected at least 3 characters

      514 |   va_list ap;
          |           ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:515:12: warning: do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
      515 |   va_start(ap, fmt);
          |            ^

    /examples/kilo.cpp:516:3: warning: [cert-err33-c]

    the value returned by this function should be used

      516 |   vsnprintf(&E.statusmsg[0], E.statusmsg.capacity(), fmt.c_str(), ap);
          |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:516:3: note: cast the expression to void to silence this warning

    /examples/kilo.cpp:516:3: warning: [misc-include-cleaner]

    no header providing "vsnprintf" is directly included

       27 |   vsnprintf(&E.statusmsg[0], E.statusmsg.capacity(), fmt.c_str(), ap);
          |   ^

    /examples/kilo.cpp:516:13: warning: [readability-container-data-pointer]

    'data' should be used for accessing the data pointer instead of taking the address of the 0-th element

      516 |   vsnprintf(&E.statusmsg[0], E.statusmsg.capacity(), fmt.c_str(), ap);
          |             ^~~~~~~~~~~~~~~
          |             E.statusmsg.data()
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:516:67: warning: do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
      516 |   vsnprintf(&E.statusmsg[0], E.statusmsg.capacity(), fmt.c_str(), ap);
          |                                                                   ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:517:10: warning: do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
      517 |   va_end(ap);
          |          ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:527:7: warning: do not call c-style vararg functions [cppcoreguidelines-pro-type-vararg,hicpp-vararg]
      527 |       editorSetStatusMessage("Save aborted");
          |       ^

    /examples/kilo.cpp:533:3: warning: [misc-const-correctness]

    variable 'text' of type 'std::string' (aka 'basic_string') can be declared 'const'

      533 |   std::string   text = editorRowsToString();
          |   ^
          |                 const 
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:539:3: warning: do not call c-style vararg functions [cppcoreguidelines-pro-type-vararg,hicpp-vararg]
      539 |   editorSetStatusMessage("%d bytes written to disk", text.size());
          |   ^

    /examples/kilo.cpp:552:6: warning: [readability-implicit-bool-conversion]

    implicit conversion 'char *' -> bool

      552 |   if(saved_hl)
          |      ^       
          |               != nullptr

    /examples/kilo.cpp:554:12: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      554 |     memcpy(E.row[saved_hl_line].hl, saved_hl, static_cast<size_t>(E.row[saved_hl_line].rsize));
          |            ^

    /examples/kilo.cpp:554:67: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      554 |     memcpy(E.row[saved_hl_line].hl, saved_hl, static_cast<size_t>(E.row[saved_hl_line].rsize));
          |                                                                   ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:555:5: warning: do not manage memory manually; use RAII [cppcoreguidelines-no-malloc,hicpp-no-malloc]
      555 |     free(saved_hl);
          |     ^~~~~~~~~~~~~~

    /examples/kilo.cpp:555:5: warning: [cppcoreguidelines-owning-memory]

    calling legacy resource function without passing a 'gsl::owner<>'

      555 |     free(saved_hl);
          |     ^~~~~~~~~~~~~~

    /examples/kilo.cpp:555:5: warning: [misc-include-cleaner]

    no header providing "free" is directly included

       27 |     free(saved_hl);
          |     ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:565:3: warning: do not use 'else' after 'return' [llvm-else-after-return,readability-else-after-return]
      565 |   else if(key == Term::Key::ArrowRight || key == Term::Key::ArrowDown) { direction = 1; }
          |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      566 |   else if(key == Term::Key::ArrowLeft || key == Term::Key::ArrowUp) { direction = -1; }
          |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      567 |   else
          |   ~~~~
      568 |   {
          |   ~
      569 |     last_match = -1;
          |     ~~~~~~~~~~~~~~~~
      570 |     direction  = 1;
          |     ~~~~~~~~~~~~~~~
      571 |   }
          |   ~
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:573:23: warning: statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
      573 |   if(last_match == -1) direction = 1;
          |                       ^              
          |                        {

    /examples/kilo.cpp:575:20: warning: [clang-diagnostic-sign-compare]

    comparison of integers of different signs: 'int' and 'std::size_t' (aka 'unsigned long')

      575 |   for(int i = 0; i < E.numrows; i++)
          |                  ~ ^ ~~~~~~~~~
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:578:35: warning: narrowing conversion from 'std::size_t' (aka 'unsigned long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]
      578 |     if(current == -1) { current = E.numrows - 1; }
          |                                   ^

    /examples/kilo.cpp:579:21: warning: [clang-diagnostic-sign-compare]

    comparison of integers of different signs: 'int' and 'std::size_t' (aka 'unsigned long')

      579 |     else if(current == E.numrows) { current = 0; }
          |             ~~~~~~~ ^  ~~~~~~~~~

    /examples/kilo.cpp:581:20: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      581 |     erow* row   = &E.row[current];
          |                    ^

    /examples/kilo.cpp:583:8: warning: [readability-implicit-bool-conversion]

    implicit conversion 'char *' -> bool

      583 |     if(match)
          |        ^    
          |              != nullptr

    /examples/kilo.cpp:591:7: warning: [cppcoreguidelines-owning-memory]

    assigning newly created 'gsl::owner<>' to non-owner 'char *'

      591 |       saved_hl      = reinterpret_cast<char*>(malloc(static_cast<size_t>(row->rsize)));
          |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    /examples/kilo.cpp:591:23: warning: [cppcoreguidelines-pro-type-reinterpret-cast]

    do not use reinterpret_cast

      591 |       saved_hl      = reinterpret_cast<char*>(malloc(static_cast<size_t>(row->rsize)));
          |                       ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:591:47: warning: do not manage memory manually; consider a container or a smart pointer [cppcoreguidelines-no-malloc,hicpp-no-malloc]
      591 |       saved_hl      = reinterpret_cast<char*>(malloc(static_cast<size_t>(row->rsize)));
          |                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    /examples/kilo.cpp:591:47: warning: [misc-include-cleaner]

    no header providing "malloc" is directly included

       27 |       saved_hl      = reinterpret_cast<char*>(malloc(static_cast<size_t>(row->rsize)));
          |                                               ^

    /examples/kilo.cpp:592:33: warning: [concurrency-mt-unsafe]

    function is not thread safe

      592 |       if(saved_hl == nullptr) { exit(-1); /*TODO: better handler*/ }
          |                                 ^

    /examples/kilo.cpp:592:33: warning: [misc-include-cleaner]

    no header providing "exit" is directly included

       27 |       if(saved_hl == nullptr) { exit(-1); /*TODO: better handler*/ }
          |                                 ^

    /examples/kilo.cpp:594:15: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      594 |       memset(&row->hl[match - row->render], HL_MATCH, query.size());
          |               ^

    /examples/kilo.cpp:607:3: warning: [misc-const-correctness]

    variable 'query' of type 'std::string' (aka 'basic_string') can be declared 'const'

      607 |   std::string query = editorPrompt("Search: %s (Use ESC/Arrows/Enter)", editorFindCallback);
          |   ^
          |               const 

    /examples/kilo.cpp:623:50: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      623 |   if(E.cy < E.numrows) { E.rx = editorRowCxToRx(&E.row[E.cy], E.cx); }
          |                                                  ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:623:63: warning: narrowing conversion from 'std::size_t' (aka 'unsigned long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]
      623 |   if(E.cy < E.numrows) { E.rx = editorRowCxToRx(&E.row[E.cy], E.cx); }
          |                                                               ^

    /examples/kilo.cpp:627:11: warning: [clang-diagnostic-sign-compare]

    comparison of integers of different signs: 'int' and 'std::size_t' (aka 'unsigned long')

      627 |   if(E.rx < E.coloff) { E.coloff = E.rx; }
          |      ~~~~ ^ ~~~~~~~~

    /examples/kilo.cpp:628:11: warning: [clang-diagnostic-sign-compare]

    comparison of integers of different signs: 'int' and 'std::size_t' (aka 'unsigned long')

      628 |   if(E.rx >= E.coloff + E.screencols) { E.coloff = E.rx - E.screencols + 1; }
          |      ~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~

    /examples/kilo.cpp:631:6: warning: [readability-function-cognitive-complexity]

    function 'editorDrawRows' has cognitive complexity of 56 (threshold 25)

      631 | void editorDrawRows(std::string& screen)
          |      ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:633:3: note: +1, including nesting penalty of 0, nesting level increased to 1
      633 |   for(int y = 0; y < E.screenrows; y++)
          |   ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:636:5: note: +2, including nesting penalty of 1, nesting level increased to 2
      636 |     if(filerow >= E.numrows)
          |     ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:638:7: note: +3, including nesting penalty of 2, nesting level increased to 3
      638 |       if(E.numrows == 0 && y == E.screenrows / 3)
          |       ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:638:25: note: +1
      638 |       if(E.numrows == 0 && y == E.screenrows / 3)
          |                         ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:642:9: note: +4, including nesting penalty of 3, nesting level increased to 4
      642 |         if(welcomelen > E.screencols) welcomelen = E.screencols;
          |         ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:644:9: note: +4, including nesting penalty of 3, nesting level increased to 4
      644 |         if(padding)
          |         ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:649:9: note: +4, including nesting penalty of 3, nesting level increased to 4
      649 |         while(padding--) screen.append(" ");
          |         ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:652:7: note: +1, nesting level increased to 3
      652 |       else { screen.append("~"); }
          |       ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:654:5: note: +1, nesting level increased to 2
      654 |     else
          |     ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:657:7: note: +3, including nesting penalty of 2, nesting level increased to 3
      657 |       if(len < 0) len = 0;
          |       ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:658:7: note: +3, including nesting penalty of 2, nesting level increased to 3
      658 |       if(len > E.screencols) len = E.screencols;
          |       ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:663:7: note: +3, including nesting penalty of 2, nesting level increased to 3
      663 |       for(j = 0; j < len; j++)
          |       ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:665:9: note: +4, including nesting penalty of 3, nesting level increased to 4
      665 |         if(iscntrl(c[j]))
          |         ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:667:35: note: +5, including nesting penalty of 4, nesting level increased to 5
      667 |           char sym = (c[j] <= 26) ? '@' + c[j] : '?';
          |                                   ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:671:11: note: +5, including nesting penalty of 4, nesting level increased to 5
      671 |           if(current_color != Term::Color::Name::Default) { screen.append(color_fg(current_color)); }
          |           ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:673:14: note: +1, nesting level increased to 4
      673 |         else if(hl[j] == HL_NORMAL)
          |              ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:675:11: note: +5, including nesting penalty of 4, nesting level increased to 5
      675 |           if(current_color != Term::Color::Name::Black)
          |           ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:682:9: note: +1, nesting level increased to 4
      682 |         else
          |         ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:685:11: note: +5, including nesting penalty of 4, nesting level increased to 5
      685 |           if(color != current_color)
          |           ^

    /examples/kilo.cpp:633:11: warning: [readability-identifier-length]

    loop variable name 'y' is too short, expected at least 2 characters

      633 |   for(int y = 0; y < E.screenrows; y++)
          |           ^

    /examples/kilo.cpp:633:18: warning: [altera-id-dependent-backward-branch]

    backward branch (for loop) is ID-dependent due to member reference to 'screenrows' and may cause performance degradation

      633 |   for(int y = 0; y < E.screenrows; y++)
          |                  ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:106:3: note: inferred assignment of ID-dependent member from ID-dependent 
      106 |   std::size_t  screenrows{0};
          |   ^

    /examples/kilo.cpp:633:20: warning: [clang-diagnostic-sign-compare]

    comparison of integers of different signs: 'int' and 'std::size_t' (aka 'unsigned long')

      633 |   for(int y = 0; y < E.screenrows; y++)
          |                  ~ ^ ~~~~~~~~~~~~

    /examples/kilo.cpp:635:5: warning: [misc-const-correctness]

    variable 'filerow' of type 'int' can be declared 'const'

      635 |     int filerow = y + E.rowoff;
          |     ^
          |         const 
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:635:19: warning: narrowing conversion from 'std::size_t' (aka 'unsigned long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]
      635 |     int filerow = y + E.rowoff;
          |                   ^

    /examples/kilo.cpp:636:16: warning: [clang-diagnostic-sign-compare]

    comparison of integers of different signs: 'int' and 'std::size_t' (aka 'unsigned long')

      636 |     if(filerow >= E.numrows)
          |        ~~~~~~~ ^  ~~~~~~~~~
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:640:9: warning: do not declare C-style arrays, use std::array<> instead [cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays]
      640 |         char welcome[80];
          |         ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:640:22: warning: 80 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
      640 |         char welcome[80];
          |                      ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:641:27: warning: do not call c-style vararg functions [cppcoreguidelines-pro-type-vararg,hicpp-vararg]
      641 |         int  welcomelen = snprintf(welcome, sizeof(welcome), "Kilo editor -- version %s", KILO_VERSION.c_str());
          |                           ^

    /examples/kilo.cpp:641:27: warning: [misc-include-cleaner]

    no header providing "snprintf" is directly included

       27 |         int  welcomelen = snprintf(welcome, sizeof(welcome), "Kilo editor -- version %s", KILO_VERSION.c_str());
          |                           ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:641:36: warning: do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
      641 |         int  welcomelen = snprintf(welcome, sizeof(welcome), "Kilo editor -- version %s", KILO_VERSION.c_str());
          |                                    ^

    /examples/kilo.cpp:642:23: warning: [clang-diagnostic-sign-compare]

    comparison of integers of different signs: 'int' and 'std::size_t' (aka 'unsigned long')

      642 |         if(welcomelen > E.screencols) welcomelen = E.screencols;
          |            ~~~~~~~~~~ ^ ~~~~~~~~~~~~
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:642:38: warning: statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
      642 |         if(welcomelen > E.screencols) welcomelen = E.screencols;
          |                                      ^                          
          |                                       {
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:642:52: warning: narrowing conversion from 'std::size_t' (aka 'unsigned long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]
      642 |         if(welcomelen > E.screencols) welcomelen = E.screencols;
          |                                                    ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:643:23: warning: narrowing conversion from 'std::size_t' (aka 'unsigned long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]
      643 |         int padding = (E.screencols - welcomelen) / 2;
          |                       ^

    /examples/kilo.cpp:644:12: warning: [readability-implicit-bool-conversion]

    implicit conversion 'int' -> bool

      644 |         if(padding)
          |            ^      
          |                    != 0

    /examples/kilo.cpp:649:15: warning: [altera-id-dependent-backward-branch]

    backward branch (while loop) is ID-dependent due to variable reference to 'padding' and may cause performance degradation

      649 |         while(padding--) screen.append(" ");
          |               ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:643:9: note: inferred assignment of ID-dependent value from ID-dependent member screencols
      643 |         int padding = (E.screencols - welcomelen) / 2;
          |         ^

    /examples/kilo.cpp:649:15: warning: [readability-implicit-bool-conversion]

    implicit conversion 'int' -> bool

      649 |         while(padding--) screen.append(" ");
          |               ^        
          |               (        ) != 0
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:649:25: warning: statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
      649 |         while(padding--) screen.append(" ");
          |                         ^                   
          |                          {
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:650:23: warning: do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
      650 |         screen.append(welcome);
          |                       ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:656:17: warning: narrowing conversion from 'std::size_t' (aka 'unsigned long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]
      656 |       int len = E.row[filerow].rsize - E.coloff;
          |                 ^

    /examples/kilo.cpp:656:17: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:657:18: warning: statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
      657 |       if(len < 0) len = 0;
          |                  ^        
          |                   {

    /examples/kilo.cpp:658:14: warning: [clang-diagnostic-sign-compare]

    comparison of integers of different signs: 'int' and 'std::size_t' (aka 'unsigned long')

      658 |       if(len > E.screencols) len = E.screencols;
          |          ~~~ ^ ~~~~~~~~~~~~
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:658:29: warning: statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
      658 |       if(len > E.screencols) len = E.screencols;
          |                             ^                   
          |                              {
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:658:36: warning: narrowing conversion from 'std::size_t' (aka 'unsigned long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]
      658 |       if(len > E.screencols) len = E.screencols;
          |                                    ^

    /examples/kilo.cpp:659:22: warning: [readability-identifier-length]

    variable name 'c' is too short, expected at least 3 characters

      659 |       char*          c             = &E.row[filerow].render[E.coloff];
          |                      ^

    /examples/kilo.cpp:659:39: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      659 |       char*          c             = &E.row[filerow].render[E.coloff];
          |                                       ^

    /examples/kilo.cpp:660:22: warning: [readability-identifier-length]

    variable name 'hl' is too short, expected at least 3 characters

      660 |       unsigned char* hl            = &E.row[filerow].hl[E.coloff];
          |                      ^

    /examples/kilo.cpp:660:39: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      660 |       unsigned char* hl            = &E.row[filerow].hl[E.coloff];
          |                                       ^

    /examples/kilo.cpp:662:22: warning: [cppcoreguidelines-init-variables]

    variable 'j' is not initialized

      662 |       int            j;
          |                      ^
          |                        = 0

    /examples/kilo.cpp:662:22: warning: [readability-identifier-length]

    variable name 'j' is too short, expected at least 3 characters

    /examples/kilo.cpp:663:18: warning: [altera-id-dependent-backward-branch]

    backward branch (for loop) is ID-dependent due to variable reference to 'len' and may cause performance degradation

      663 |       for(j = 0; j < len; j++)
          |                  ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:656:7: note: inferred assignment of ID-dependent value from ID-dependent member rsize
      656 |       int len = E.row[filerow].rsize - E.coloff;
          |       ^

    /examples/kilo.cpp:665:12: warning: [misc-include-cleaner]

    no header providing "iscntrl" is directly included

       25 |         if(iscntrl(c[j]))
          |            ^

    /examples/kilo.cpp:665:12: warning: [readability-implicit-bool-conversion]

    implicit conversion 'int' -> bool

      665 |         if(iscntrl(c[j]))
          |            ^            
          |                          != 0

    /examples/kilo.cpp:665:20: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      665 |         if(iscntrl(c[j]))
          |                    ^

    /examples/kilo.cpp:667:11: warning: [misc-const-correctness]

    variable 'sym' of type 'char' can be declared 'const'

      667 |           char sym = (c[j] <= 26) ? '@' + c[j] : '?';
          |           ^
          |                const 

    /examples/kilo.cpp:667:23: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      667 |           char sym = (c[j] <= 26) ? '@' + c[j] : '?';
          |                       ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:667:31: warning: 26 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
      667 |           char sym = (c[j] <= 26) ? '@' + c[j] : '?';
          |                               ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:667:41: warning: narrowing conversion from 'int' to signed type 'char' is implementation-defined [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]
      667 |           char sym = (c[j] <= 26) ? '@' + c[j] : '?';
          |                                         ^

    /examples/kilo.cpp:667:43: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      667 |           char sym = (c[j] <= 26) ? '@' + c[j] : '?';
          |                                           ^

    /examples/kilo.cpp:673:17: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      673 |         else if(hl[j] == HL_NORMAL)
          |                 ^

    /examples/kilo.cpp:680:38: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      680 |           screen.append(std::string(&c[j], 1));
          |                                      ^

    /examples/kilo.cpp:684:11: warning: [misc-const-correctness]

    variable 'color' of type 'Term::Color' can be declared 'const'

      684 |           Term::Color color = editorSyntaxToColor(hl[j]);
          |           ^
          |                       const 

    /examples/kilo.cpp:684:51: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      684 |           Term::Color color = editorSyntaxToColor(hl[j]);
          |                                                   ^

    /examples/kilo.cpp:690:38: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      690 |           screen.append(std::string(&c[j], 1));
          |                                      ^

    /examples/kilo.cpp:696:25: warning: [misc-include-cleaner]

    no header providing "Term::clear_eol" is directly included

       12 |     screen.append(Term::clear_eol());
          |                         ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:717:87: warning: statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
      717 |     if(E.screencols - size > 0 && (left1.size() - E.screencols + size) < left1.size()) screen += left1.substr(left1.size() - E.screencols + size, E.screencols - size) + left2 + right;
          |                                                                                       ^                                                                                                
          |                                                                                        {

    /examples/kilo.cpp:725:23: warning: [misc-include-cleaner]

    no header providing "Term::clear_eol" is directly included

       12 |   screen.append(Term::clear_eol());
          |                       ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:726:40: warning: statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
      726 |   if(E.statusmsg.size() > E.screencols) E.statusmsg.resize(E.screencols);
          |                                        ^                                 
          |                                         {

    /examples/kilo.cpp:735:23: warning: [misc-include-cleaner]

    no header providing "Term::cursor_off" is directly included

       12 |   screen.append(Term::cursor_off());
          |                       ^

    /examples/kilo.cpp:736:23: warning: [misc-include-cleaner]

    no header providing "Term::cursor_move" is directly included

       12 |   screen.append(Term::cursor_move(1, 1));
          |                       ^

    /examples/kilo.cpp:740:23: warning: [misc-include-cleaner]

    no header providing "Term::cursor_move" is directly included

       12 |   screen.append(Term::cursor_move(static_cast<size_t>((E.cy - E.rowoff) + 1), static_cast<size_t>((E.rx - E.coloff) + 1)));
          |                       ^

    /examples/kilo.cpp:741:23: warning: [misc-include-cleaner]

    no header providing "Term::cursor_on" is directly included

       12 |   screen.append(Term::cursor_on());
          |                       ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:750:15: warning: 128 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
      750 |   buf.reserve(128);
          |               ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:753:5: warning: do not call c-style vararg functions [cppcoreguidelines-pro-type-vararg,hicpp-vararg]
      753 |     editorSetStatusMessage(prompt, buf.c_str());
          |     ^

    /examples/kilo.cpp:756:5: warning: [misc-const-correctness]

    variable 'c' of type 'Term::Key' can be declared 'const'

      756 |     Term::Key c = Term::read_event();
          |     ^
          |               const 

    /examples/kilo.cpp:756:15: warning: [readability-identifier-length]

    variable name 'c' is too short, expected at least 3 characters

      756 |     Term::Key c = Term::read_event();
          |               ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:758:18: warning: statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
      758 |     if(c.empty()) continue;
          |                  ^
          |                   {
      759 |     else if(c == Term::Key::Del || c == Term::Key::Ctrl_H || c == Term::Key::Backspace)
          |     } 
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:759:5: warning: do not use 'else' after 'continue' [llvm-else-after-return,readability-else-after-return]
      759 |     else if(c == Term::Key::Del || c == Term::Key::Ctrl_H || c == Term::Key::Backspace)
          |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      760 |     {
          |     ~
      761 |       if(!buf.empty()) buf.pop_back();
          |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      762 |     }
          |     ~
      763 |     else if(c == Term::Key::Esc)
          |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      764 |     {
          |     ~
      765 |       editorSetStatusMessage("");
          |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~
      766 |       if(callback) callback(buf, c);
          |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      767 |       return {};
          |       ~~~~~~~~~~
      768 |     }
          |     ~
      769 |     else if(c == Term::Key::Enter)
          |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      770 |     {
          |     ~
      771 |       if(!buf.empty())
          |       ~~~~~~~~~~~~~~~~
      772 |       {
          |       ~
      773 |         editorSetStatusMessage("");
          |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~
      774 |         if(callback) callback(buf, c);
          |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:761:23: warning: statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
      761 |       if(!buf.empty()) buf.pop_back();
          |                       ^
    note: this fix will not be applied because it overlaps with another fix
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:765:7: warning: do not call c-style vararg functions [cppcoreguidelines-pro-type-vararg,hicpp-vararg]
      765 |       editorSetStatusMessage("");
          |       ^

    /examples/kilo.cpp:766:10: warning: [readability-implicit-bool-conversion]

    implicit conversion 'void ()(std::string &, const Term::Key &)' (aka 'void ()(basic_string &, const Term::Key &)') -> bool

      766 |       if(callback) callback(buf, c);
          |          ^
    note: this fix will not be applied because it overlaps with another fix
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:766:19: warning: statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
      766 |       if(callback) callback(buf, c);
          |                   ^
    note: this fix will not be applied because it overlaps with another fix
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:773:9: warning: do not call c-style vararg functions [cppcoreguidelines-pro-type-vararg,hicpp-vararg]
      773 |         editorSetStatusMessage("");
          |         ^

    /examples/kilo.cpp:774:12: warning: [readability-implicit-bool-conversion]

    implicit conversion 'void ()(std::string &, const Term::Key &)' (aka 'void ()(basic_string &, const Term::Key &)') -> bool

      774 |         if(callback) callback(buf, c);
          |            ^
    note: this fix will not be applied because it overlaps with another fix
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:774:21: warning: statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
      774 |         if(callback) callback(buf, c);
          |                     ^
    note: this fix will not be applied because it overlaps with another fix

    /examples/kilo.cpp:780:8: warning: [readability-implicit-bool-conversion]

    implicit conversion 'void ()(std::string &, const Term::Key &)' (aka 'void ()(basic_string &, const Term::Key &)') -> bool

      780 |     if(callback) callback(buf, c);
          |        ^       
          |                 != nullptr
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:780:17: warning: statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
      780 |     if(callback) callback(buf, c);
          |                 ^                 
          |                  {

    /examples/kilo.cpp:786:48: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      786 |   erow* row = (E.cy >= E.numrows) ? nullptr : &E.row[E.cy];
          |                                                ^

    /examples/kilo.cpp:795:16: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      795 |         E.cx = E.row[E.cy].size;
          |                ^

    /examples/kilo.cpp:799:10: warning: [readability-implicit-bool-conversion]

    implicit conversion 'erow *' -> bool

      799 |       if(row && E.cx < row->size) { E.cx++; }
          |          ^
          |          (   != nullptr)

    /examples/kilo.cpp:799:22: warning: [clang-diagnostic-sign-compare]

    comparison of integers of different signs: 'std::size_t' (aka 'unsigned long') and 'int'

      799 |       if(row && E.cx < row->size) { E.cx++; }
          |                 ~~~~ ^ ~~~~~~~~~

    /examples/kilo.cpp:800:15: warning: [readability-implicit-bool-conversion]

    implicit conversion 'erow *' -> bool

      800 |       else if(row && E.cx == row->size)
          |               ^
          |               (   != nullptr)

    /examples/kilo.cpp:800:27: warning: [clang-diagnostic-sign-compare]

    comparison of integers of different signs: 'std::size_t' (aka 'unsigned long') and 'int'

      800 |       else if(row && E.cx == row->size)
          |                      ~~~~ ^  ~~~~~~~~~

    /examples/kilo.cpp:815:49: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      815 |   row        = (E.cy >= E.numrows) ? nullptr : &E.row[E.cy];
          |                                                 ^

    /examples/kilo.cpp:816:3: warning: [misc-const-correctness]

    variable 'rowlen' of type 'int' can be declared 'const'

      816 |   int rowlen = row ? row->size : 0;
          |   ^
          |       const 

    /examples/kilo.cpp:816:16: warning: [readability-implicit-bool-conversion]

    implicit conversion 'erow *' -> bool

      816 |   int rowlen = row ? row->size : 0;
          |                ^
          |                    != nullptr

    /examples/kilo.cpp:817:11: warning: [clang-diagnostic-sign-compare]

    comparison of integers of different signs: 'std::size_t' (aka 'unsigned long') and 'int'

      817 |   if(E.cx > rowlen) { E.cx = rowlen; }
          |      ~~~~ ^ ~~~~~~

    /examples/kilo.cpp:820:6: warning: [readability-function-cognitive-complexity]

    function 'editorProcessKeypress' has cognitive complexity of 39 (threshold 25)

      820 | bool editorProcessKeypress()
          |      ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:825:3: note: +1, including nesting penalty of 0, nesting level increased to 1
      825 |   switch(event.type())
          |   ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:830:7: note: +2, including nesting penalty of 1, nesting level increased to 2
      830 |       switch(key)
          |       ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:839:11: note: +3, including nesting penalty of 2, nesting level increased to 3
      839 |           if(E.dirty == true && quit_times > 0)
          |           ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:839:30: note: +1
      839 |           if(E.dirty == true && quit_times > 0)
          |                              ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:859:11: note: +3, including nesting penalty of 2, nesting level increased to 3
      859 |           if(E.cy < E.numrows) { E.cx = E.row[E.cy].size; }
          |           ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:870:11: note: +3, including nesting penalty of 2, nesting level increased to 3
      870 |           if(key == Term::Key::Del) { ::editorMoveCursor(Term::Key::ArrowRight); }
          |           ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:877:11: note: +3, including nesting penalty of 2, nesting level increased to 3
      877 |           if(key == Term::Key::PageUp) { E.cy = E.rowoff; }
          |           ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:878:16: note: +1, nesting level increased to 3
      878 |           else if(key == Term::Key::PageDown)
          |                ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:881:13: note: +4, including nesting penalty of 3, nesting level increased to 4
      881 |             if(E.cy > E.numrows) E.cy = E.numrows;
          |             ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:885:11: note: +3, including nesting penalty of 2, nesting level increased to 3
      885 |           while(times--) { ::editorMoveCursor(key == Term::Key::PageUp ? Term::Key::ArrowUp : Term::Key::ArrowDown); }
          |           ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:885:72: note: +4, including nesting penalty of 3, nesting level increased to 4
      885 |           while(times--) { ::editorMoveCursor(key == Term::Key::PageUp ? Term::Key::ArrowUp : Term::Key::ArrowDown); }
          |                                                                        ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:909:11: note: +3, including nesting penalty of 2, nesting level increased to 3
      909 |           if((!key.hasCtrlAll()) && (key.isASCII())) { editorInsertChar(key); }  //FIXME UTF8 !
          |           ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:909:34: note: +1
      909 |           if((!key.hasCtrlAll()) && (key.isASCII())) { editorInsertChar(key); }  //FIXME UTF8 !
          |                                  ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:923:7: note: +2, including nesting penalty of 1, nesting level increased to 2
      923 |       switch(mouse.getButton().type())
          |       ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:927:11: note: +3, including nesting penalty of 2, nesting level increased to 3
      927 |           if(mouse.getButton().action() == Term::Button::Action::RolledDown) { ::editorMoveCursor(Term::Key::ArrowDown); }
          |           ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:928:16: note: +1, nesting level increased to 3
      928 |           else if(mouse.getButton().action() == Term::Button::Action::RolledUp) { ::editorMoveCursor(Term::Key::ArrowUp); }
          |                ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:929:11: note: +1, nesting level increased to 3
      929 |           else { break; }
          |           ^

    /examples/kilo.cpp:824:3: warning: [misc-const-correctness]

    variable 'event' of type 'Term::Event' can be declared 'const'

      824 |   Term::Event event{Term::read_event()};
          |   ^
          |               const 

    /examples/kilo.cpp:829:7: warning: [misc-const-correctness]

    variable 'key' of type 'Term::Key' can be declared 'const'

      829 |       Term::Key key = event;
          |       ^
          |                 const 

    /examples/kilo.cpp:839:25: warning: [readability-simplify-boolean-expr]

    redundant boolean literal supplied to boolean operator

      839 |           if(E.dirty == true && quit_times > 0)
          |              ~~~~~~~~~~~^~~~
          |              E.dirty
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:841:13: warning: do not call c-style vararg functions [cppcoreguidelines-pro-type-vararg,hicpp-vararg]
      841 |             ::editorSetStatusMessage("WARNING!!! File has unsaved changes. Press Ctrl-Q %d more times to quit.", quit_times);
          |             ^

    /examples/kilo.cpp:859:41: warning: [cppcoreguidelines-pro-bounds-pointer-arithmetic]

    do not use pointer arithmetic

      859 |           if(E.cy < E.numrows) { E.cx = E.row[E.cy].size; }
          |                                         ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:881:33: warning: statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
      881 |             if(E.cy > E.numrows) E.cy = E.numrows;
          |                                 ^                 
          |                                  {
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:884:23: warning: narrowing conversion from 'std::size_t' (aka 'unsigned long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]
      884 |           int times = E.screenrows;
          |                       ^

    /examples/kilo.cpp:885:17: warning: [altera-id-dependent-backward-branch]

    backward branch (while loop) is ID-dependent due to variable reference to 'times' and may cause performance degradation

      885 |           while(times--) { ::editorMoveCursor(key == Term::Key::PageUp ? Term::Key::ArrowUp : Term::Key::ArrowDown); }
          |                 ^
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:884:11: note: inferred assignment of ID-dependent value from ID-dependent member screenrows
      884 |           int times = E.screenrows;
          |           ^

    /examples/kilo.cpp:885:17: warning: [readability-implicit-bool-conversion]

    implicit conversion 'int' -> bool

      885 |           while(times--) { ::editorMoveCursor(key == Term::Key::PageUp ? Term::Key::ArrowUp : Term::Key::ArrowDown); }
          |                 ^      
          |                 (      ) != 0

    /examples/kilo.cpp:922:7: warning: [misc-const-correctness]

    variable 'mouse' of type 'Term::Mouse' can be declared 'const'

      922 |       Term::Mouse mouse = event;
          |       ^
          |                   const 
    /home/runner/work/cpp-terminal/cpp-terminal/examples/kilo.cpp:957:5: warning: do not call c-style vararg functions [cppcoreguidelines-pro-type-vararg,hicpp-vararg]
      957 |     editorSetStatusMessage("HELP: Ctrl-S = save | Ctrl-Q = quit | Ctrl-F = find");
          |     ^

    /examples/kilo.cpp:964:64: warning: [performance-avoid-endl]

    do not use 'std::endl' with streams; use '\n' instead

      964 |     std::cerr << "cpp-terminal error: " << exception.what() << std::endl;
          |                                                                ^~~~~~~~~
          |                                                                '\n'

    /examples/kilo.cpp:965:5: warning: [concurrency-mt-unsafe]

    function is not thread safe

      965 |     std::exit(2);
          |     ^

    /examples/kilo.cpp:965:10: warning: [misc-include-cleaner]

    no header providing "std::exit" is directly included

       27 |     std::exit(2);
          |          ^

    /examples/kilo.cpp:967:20: warning: [misc-include-cleaner]

    no header providing "std::exception" is directly included

       28 |   catch(const std::exception& exception)
          |                    ^

    /examples/kilo.cpp:969:51: warning: [performance-avoid-endl]

    do not use 'std::endl' with streams; use '\n' instead

      969 |     std::cerr << "error: " << exception.what() << std::endl;
          |                                                   ^~~~~~~~~
          |                                                   '\n'

    /examples/kilo.cpp:970:5: warning: [concurrency-mt-unsafe]

    function is not thread safe

      970 |     std::exit(2);
          |     ^

    /examples/kilo.cpp:970:10: warning: [misc-include-cleaner]

    no header providing "std::exit" is directly included

       27 |     std::exit(2);
          |          ^

    /examples/kilo.cpp:974:38: warning: [performance-avoid-endl]

    do not use 'std::endl' with streams; use '\n' instead

      974 |     std::cerr << "Unknown error." << std::endl;
          |                                      ^~~~~~~~~
          |                                      '\n'

    /examples/kilo.cpp:975:5: warning: [concurrency-mt-unsafe]

    function is not thread safe

      975 |     std::exit(1);
          |     ^

    /examples/kilo.cpp:975:10: warning: [misc-include-cleaner]

    no header providing "std::exit" is directly included

       27 |     std::exit(1);
          |          ^

Have any feedback or feature suggestions? Share it here.

Please sign in to comment.