aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/eval.c5
-rw-r--r--src/nvim/main.c7
-rw-r--r--src/nvim/screen.c7
-rw-r--r--src/nvim/syntax.c8
-rw-r--r--src/nvim/ui.c10
5 files changed, 24 insertions, 13 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index d60ce2de73..417efd52a1 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -76,6 +76,7 @@
#include "nvim/tag.h"
#include "nvim/tempfile.h"
#include "nvim/term.h"
+#include "nvim/ui.h"
#include "nvim/mouse.h"
#include "nvim/undo.h"
#include "nvim/version.h"
@@ -10023,6 +10024,8 @@ static void f_has(typval_T *argvars, typval_T *rettv)
#endif
} else if (STRICMP(name, "syntax_items") == 0) {
n = syntax_present(curwin);
+ } else if (STRICMP(name, "gui_running") == 0) {
+ n = ui_rgb_attached();
}
}
@@ -14440,7 +14443,7 @@ static void f_synIDattr(typval_T *argvars, typval_T *rettv)
if (modec != 't' && modec != 'c' && modec != 'g')
modec = 0; /* replace invalid with current */
} else {
- if (t_colors > 1)
+ if (abstract_ui || t_colors > 1)
modec = 'c';
else
modec = 't';
diff --git a/src/nvim/main.c b/src/nvim/main.c
index f063cc1238..7ca26a6eba 100644
--- a/src/nvim/main.c
+++ b/src/nvim/main.c
@@ -261,10 +261,7 @@ int main(int argc, char **argv)
if (params.want_full_screen && !silent_mode) {
if (embedded_mode) {
- // In embedded mode don't do terminal-related initializations, assume an
- // initial screen size of 80x20
- full_screen = true;
- screen_resize(80, 20, false);
+ // embedded mode implies abstract_ui
termcapinit((uint8_t *)"abstract_ui");
} else {
// set terminal name and get terminal capabilities (will set full_screen)
@@ -278,7 +275,9 @@ int main(int argc, char **argv)
event_init();
if (abstract_ui) {
+ full_screen = true;
t_colors = 256;
+ T_CCO = (uint8_t *)"256";
} else {
// Print a warning if stdout is not a terminal TODO(tarruda): Remove this
// check once the new terminal UI is implemented
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index 5cfda13dbd..7d29cc7e2d 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -6150,8 +6150,7 @@ void screen_fill(int start_row, int end_row, int start_col, int end_col, int c1,
return;
/* it's a "normal" terminal when not in a GUI or cterm */
- norm_term = (
- t_colors <= 1);
+ norm_term = (!abstract_ui && t_colors <= 1);
for (row = start_row; row < end_row; ++row) {
if (has_mbyte
) {
@@ -6675,8 +6674,8 @@ static void linecopy(int to, int from, win_T *wp)
*/
int can_clear(char_u *p)
{
- return *p != NUL && (t_colors <= 1
- || cterm_normal_bg_color == 0 || *T_UT != NUL);
+ return abstract_ui || (*p != NUL && (t_colors <= 1
+ || cterm_normal_bg_color == 0 || *T_UT != NUL));
}
/*
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c
index efb449f037..8ff0c71f69 100644
--- a/src/nvim/syntax.c
+++ b/src/nvim/syntax.c
@@ -6450,7 +6450,7 @@ do_highlight (
p = T_CAF;
else
p = T_CSF;
- if (*p != NUL && *(p + STRLEN(p) - 1) == 'm')
+ if (abstract_ui || (*p != NUL && *(p + STRLEN(p) - 1) == 'm'))
switch (t_colors) {
case 16:
color = color_numbers_8[i];
@@ -6865,7 +6865,7 @@ int hl_combine_attr(int char_attr, int prim_attr)
if (char_attr <= HL_ALL && prim_attr <= HL_ALL)
return char_attr | prim_attr;
- if (t_colors > 1) {
+ if (abstract_ui || t_colors > 1) {
if (char_attr > HL_ALL)
char_aep = syn_cterm_attr2entry(char_attr);
if (char_aep != NULL)
@@ -6929,7 +6929,7 @@ int syn_attr2attr(int attr)
{
attrentry_T *aep;
- if (t_colors > 1)
+ if (abstract_ui || t_colors > 1)
aep = syn_cterm_attr2entry(attr);
else
aep = syn_term_attr2entry(attr);
@@ -7357,7 +7357,7 @@ int syn_id2attr(int hl_id)
hl_id = syn_get_final_id(hl_id);
sgp = &HL_TABLE()[hl_id - 1]; /* index is ID minus one */
- if (t_colors > 1)
+ if (abstract_ui || t_colors > 1)
attr = sgp->sg_cterm_attr;
else
attr = sgp->sg_term_attr;
diff --git a/src/nvim/ui.c b/src/nvim/ui.c
index ef0386e395..d13c7e5feb 100644
--- a/src/nvim/ui.c
+++ b/src/nvim/ui.c
@@ -114,6 +114,16 @@ void ui_write(uint8_t *s, int len)
free(tofree);
}
+bool ui_rgb_attached(void)
+{
+ for (size_t i = 0; i < ui_count; i++) {
+ if (uis[i]->rgb) {
+ return true;
+ }
+ }
+ return false;
+}
+
/*
* If the machine has job control, use it to suspend the program,
* otherwise fake it by starting a new shell.