mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 11:28:22 +00:00
hardcopy: bold,italic,underline are TriState
This commit is contained in:
@@ -134,9 +134,9 @@ static int current_syn_id;
|
|||||||
#define PRCOLOR_BLACK 0
|
#define PRCOLOR_BLACK 0
|
||||||
#define PRCOLOR_WHITE 0xffffff
|
#define PRCOLOR_WHITE 0xffffff
|
||||||
|
|
||||||
static int curr_italic;
|
static TriState curr_italic;
|
||||||
static int curr_bold;
|
static TriState curr_bold;
|
||||||
static int curr_underline;
|
static TriState curr_underline;
|
||||||
static uint32_t curr_bg;
|
static uint32_t curr_bg;
|
||||||
static uint32_t curr_fg;
|
static uint32_t curr_fg;
|
||||||
static int page_count;
|
static int page_count;
|
||||||
@@ -417,7 +417,8 @@ static void prt_set_bg(uint32_t bg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void prt_set_font(int bold, int italic, int underline)
|
static void prt_set_font(const TriState bold, const TriState italic,
|
||||||
|
const TriState underline)
|
||||||
{
|
{
|
||||||
if (curr_bold != bold
|
if (curr_bold != bold
|
||||||
|| curr_italic != italic
|
|| curr_italic != italic
|
||||||
@@ -449,14 +450,14 @@ static void prt_line_number(prt_settings_T *psettings, int page_line, linenr_T l
|
|||||||
for (i = 0; i < 6; i++)
|
for (i = 0; i < 6; i++)
|
||||||
(void)mch_print_text_out(&tbuf[i], 1);
|
(void)mch_print_text_out(&tbuf[i], 1);
|
||||||
|
|
||||||
if (psettings->do_syntax)
|
if (psettings->do_syntax) {
|
||||||
/* Set colors for next character. */
|
// Set colors for next character.
|
||||||
current_syn_id = -1;
|
current_syn_id = -1;
|
||||||
else {
|
} else {
|
||||||
/* Set colors and font back to normal. */
|
// Set colors and font back to normal.
|
||||||
prt_set_fg(PRCOLOR_BLACK);
|
prt_set_fg(PRCOLOR_BLACK);
|
||||||
prt_set_bg(PRCOLOR_WHITE);
|
prt_set_bg(PRCOLOR_WHITE);
|
||||||
prt_set_font(FALSE, FALSE, FALSE);
|
prt_set_font(kFalse, kFalse, kFalse);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -548,7 +549,7 @@ static void prt_header(prt_settings_T *psettings, int pagenum, linenr_T lnum)
|
|||||||
|
|
||||||
prt_set_fg(PRCOLOR_BLACK);
|
prt_set_fg(PRCOLOR_BLACK);
|
||||||
prt_set_bg(PRCOLOR_WHITE);
|
prt_set_bg(PRCOLOR_WHITE);
|
||||||
prt_set_font(TRUE, FALSE, FALSE);
|
prt_set_font(kTrue, kFalse, kFalse);
|
||||||
|
|
||||||
/* Use a negative line number to indicate printing in the top margin. */
|
/* Use a negative line number to indicate printing in the top margin. */
|
||||||
page_line = 0 - prt_header_height();
|
page_line = 0 - prt_header_height();
|
||||||
@@ -567,14 +568,14 @@ static void prt_header(prt_settings_T *psettings, int pagenum, linenr_T lnum)
|
|||||||
|
|
||||||
xfree(tbuf);
|
xfree(tbuf);
|
||||||
|
|
||||||
if (psettings->do_syntax)
|
if (psettings->do_syntax) {
|
||||||
/* Set colors for next character. */
|
// Set colors for next character.
|
||||||
current_syn_id = -1;
|
current_syn_id = -1;
|
||||||
else {
|
} else {
|
||||||
/* Set colors and font back to normal. */
|
// Set colors and font back to normal.
|
||||||
prt_set_fg(PRCOLOR_BLACK);
|
prt_set_fg(PRCOLOR_BLACK);
|
||||||
prt_set_bg(PRCOLOR_WHITE);
|
prt_set_bg(PRCOLOR_WHITE);
|
||||||
prt_set_font(FALSE, FALSE, FALSE);
|
prt_set_font(kFalse, kFalse, kFalse);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -640,21 +641,19 @@ void ex_hardcopy(exarg_T *eap)
|
|||||||
else
|
else
|
||||||
settings.do_syntax = settings.has_color;
|
settings.do_syntax = settings.has_color;
|
||||||
|
|
||||||
/* Set up printing attributes for line numbers */
|
// Set up printing attributes for line numbers
|
||||||
settings.number.fg_color = PRCOLOR_BLACK;
|
settings.number.fg_color = PRCOLOR_BLACK;
|
||||||
settings.number.bg_color = PRCOLOR_WHITE;
|
settings.number.bg_color = PRCOLOR_WHITE;
|
||||||
settings.number.bold = FALSE;
|
settings.number.bold = kFalse;
|
||||||
settings.number.italic = TRUE;
|
settings.number.italic = kTrue;
|
||||||
settings.number.underline = FALSE;
|
settings.number.underline = kFalse;
|
||||||
/*
|
|
||||||
* Syntax highlighting of line numbers.
|
|
||||||
*/
|
|
||||||
if (prt_use_number() && settings.do_syntax) {
|
|
||||||
int id;
|
|
||||||
|
|
||||||
id = syn_name2id((char_u *)"LineNr");
|
// Syntax highlighting of line numbers.
|
||||||
if (id > 0)
|
if (prt_use_number() && settings.do_syntax) {
|
||||||
|
int id = syn_name2id((char_u *)"LineNr");
|
||||||
|
if (id > 0) {
|
||||||
id = syn_get_final_id(id);
|
id = syn_get_final_id(id);
|
||||||
|
}
|
||||||
|
|
||||||
prt_get_attr(id, &settings.number, settings.modec);
|
prt_get_attr(id, &settings.number, settings.modec);
|
||||||
}
|
}
|
||||||
@@ -672,13 +671,13 @@ void ex_hardcopy(exarg_T *eap)
|
|||||||
/* Set colors and font to normal. */
|
/* Set colors and font to normal. */
|
||||||
curr_bg = 0xffffffff;
|
curr_bg = 0xffffffff;
|
||||||
curr_fg = 0xffffffff;
|
curr_fg = 0xffffffff;
|
||||||
curr_italic = MAYBE;
|
curr_italic = kNone;
|
||||||
curr_bold = MAYBE;
|
curr_bold = kNone;
|
||||||
curr_underline = MAYBE;
|
curr_underline = kNone;
|
||||||
|
|
||||||
prt_set_fg(PRCOLOR_BLACK);
|
prt_set_fg(PRCOLOR_BLACK);
|
||||||
prt_set_bg(PRCOLOR_WHITE);
|
prt_set_bg(PRCOLOR_WHITE);
|
||||||
prt_set_font(FALSE, FALSE, FALSE);
|
prt_set_font(kFalse, kFalse, kFalse);
|
||||||
current_syn_id = -1;
|
current_syn_id = -1;
|
||||||
|
|
||||||
jobsplit = (printer_opts[OPT_PRINT_JOBSPLIT].present
|
jobsplit = (printer_opts[OPT_PRINT_JOBSPLIT].present
|
||||||
@@ -1266,8 +1265,8 @@ static int prt_do_moveto;
|
|||||||
static int prt_need_font;
|
static int prt_need_font;
|
||||||
static int prt_font;
|
static int prt_font;
|
||||||
static int prt_need_underline;
|
static int prt_need_underline;
|
||||||
static int prt_underline;
|
static TriState prt_underline;
|
||||||
static int prt_do_underline;
|
static TriState prt_do_underline;
|
||||||
static int prt_need_fgcol;
|
static int prt_need_fgcol;
|
||||||
static uint32_t prt_fgcol;
|
static uint32_t prt_fgcol;
|
||||||
static int prt_need_bgcol;
|
static int prt_need_bgcol;
|
||||||
@@ -2855,7 +2854,7 @@ int mch_print_begin_page(char_u *str)
|
|||||||
/* We have reset the font attributes, force setting them again. */
|
/* We have reset the font attributes, force setting them again. */
|
||||||
curr_bg = 0xffffffff;
|
curr_bg = 0xffffffff;
|
||||||
curr_fg = 0xffffffff;
|
curr_fg = 0xffffffff;
|
||||||
curr_bold = MAYBE;
|
curr_bold = kNone;
|
||||||
|
|
||||||
return !prt_file_error;
|
return !prt_file_error;
|
||||||
}
|
}
|
||||||
@@ -3059,7 +3058,8 @@ int mch_print_text_out(char_u *const textp, size_t len)
|
|||||||
return need_break;
|
return need_break;
|
||||||
}
|
}
|
||||||
|
|
||||||
void mch_print_set_font(int iBold, int iItalic, int iUnderline)
|
void mch_print_set_font(const TriState iBold, const TriState iItalic,
|
||||||
|
const TriState iUnderline)
|
||||||
{
|
{
|
||||||
int font = 0;
|
int font = 0;
|
||||||
|
|
||||||
|
@@ -2,10 +2,11 @@
|
|||||||
#define NVIM_HARDCOPY_H
|
#define NVIM_HARDCOPY_H
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h> // for size_t
|
#include <stdlib.h> // for size_t
|
||||||
|
|
||||||
#include "nvim/types.h" // for char_u
|
#include "nvim/globals.h" // for TriState
|
||||||
#include "nvim/ex_cmds_defs.h" // for exarg_T
|
#include "nvim/types.h" // for char_u
|
||||||
|
#include "nvim/ex_cmds_defs.h" // for exarg_T
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Structure to hold printing color and font attributes.
|
* Structure to hold printing color and font attributes.
|
||||||
@@ -13,9 +14,9 @@
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
uint32_t fg_color;
|
uint32_t fg_color;
|
||||||
uint32_t bg_color;
|
uint32_t bg_color;
|
||||||
int bold;
|
TriState bold;
|
||||||
int italic;
|
TriState italic;
|
||||||
int underline;
|
TriState underline;
|
||||||
int undercurl;
|
int undercurl;
|
||||||
} prt_text_attr_T;
|
} prt_text_attr_T;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user