aboutsummaryrefslogtreecommitdiffhomepage
path: root/screen.h
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2014-03-29 14:19:45 -0700
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2014-03-29 14:19:45 -0700
commitd4fafeb6d66e415e85c67700e5a370765c09bb93 (patch)
tree7e208d860649e8651180b281ec715a96169a9dbe /screen.h
parent844b01cb6be2ab3a3f7070112c94604b43710835 (diff)
parent31bf50b2d495222925371556169f61c1c5a81ed7 (diff)
Merge branch 'master' into 1218_rebase
Conflicts: builtin.cpp builtin_commandline.cpp highlight.cpp input.cpp input.h reader.cpp screen.cpp screen.h
Diffstat (limited to 'screen.h')
-rw-r--r--screen.h45
1 files changed, 44 insertions, 1 deletions
diff --git a/screen.h b/screen.h
index 78212ae5..91c78635 100644
--- a/screen.h
+++ b/screen.h
@@ -13,8 +13,11 @@
#define FISH_SCREEN_H
#include <vector>
+#include <sys/stat.h>
#include "highlight.h"
+class page_rendering_t;
+
/**
A class representing a single line of a screen.
*/
@@ -40,6 +43,17 @@ struct line_t
colors.push_back(color);
}
+ void append(const wchar_t *txt, highlight_spec_t color)
+ {
+ for (size_t i=0; txt[i]; i++)
+ {
+ text.push_back(txt[i]);
+ colors.push_back(color);
+ }
+ }
+
+
+
size_t size(void) const
{
return text.size();
@@ -55,6 +69,12 @@ struct line_t
return colors.at(idx);
}
+ void append_line(const line_t &line)
+ {
+ text.insert(text.end(), line.text.begin(), line.text.end());
+ colors.insert(colors.end(), line.colors.begin(), line.colors.end());
+ }
+
};
/**
@@ -94,6 +114,12 @@ public:
return line_datas.at(idx);
}
+ line_t &insert_line_at_index(size_t idx)
+ {
+ assert(idx <= line_datas.size());
+ return *line_datas.insert(line_datas.begin() + idx, line_t());
+ }
+
line_t &line(size_t idx)
{
return line_datas.at(idx);
@@ -103,6 +129,16 @@ public:
{
return line_datas.size();
}
+
+ void append_lines(const screen_data_t &d)
+ {
+ this->line_datas.insert(this->line_datas.end(), d.line_datas.begin(), d.line_datas.end());
+ }
+
+ bool empty() const
+ {
+ return line_datas.empty();
+ }
};
/**
@@ -184,6 +220,8 @@ public:
\param cursor_pos where the cursor is
\param sel_start_pos where the selections starts (inclusive)
\param sel_stop_pos where the selections ends (inclusive)
+ \param pager_data any pager data, to append to the screen
+ \param position_is_within_pager whether the position is within the pager line (first line)
*/
void s_write(screen_t *s,
const wcstring &left_prompt,
@@ -194,7 +232,9 @@ void s_write(screen_t *s,
const int *indent,
size_t cursor_pos,
size_t sel_start_pos,
- size_t sel_stop_pos);
+ size_t sel_stop_pos,
+ const page_rendering_t &pager_data,
+ bool position_is_within_pager);
/**
This function resets the screen buffers internal knowledge about
@@ -232,6 +272,9 @@ enum screen_reset_mode_t
void s_reset(screen_t *s, screen_reset_mode_t mode);
+/* Issues an immediate clr_eos, returning if it existed */
+bool screen_force_clear_to_end();
+
/* Returns the length of an escape code. Exposed for testing purposes only. */
size_t escape_code_length(const wchar_t *code);