Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yad
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vladislav
yad
Commits
f7461944
Commit
f7461944
authored
Apr 16, 2021
by
Victor Ananjevsky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add more options for sourceview in text dialog
parent
bede827d
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
101 additions
and
11 deletions
+101
-11
yad.1
data/yad.1
+21
-0
yad.gschema.xml.in
data/yad.gschema.xml.in
+1
-5
ru.po
po/ru.po
+0
-0
uk.po
po/uk.po
+0
-0
main.c
src/main.c
+2
-0
option.c
src/option.c
+56
-5
text.c
src/text.c
+12
-0
yad.h
src/yad.h
+9
-1
No files found.
data/yad.1
View file @
f7461944
...
...
@@ -987,6 +987,27 @@ Set background color for marks of second type to \fICOLOR\fP. Default is pink.
.TP
.B \-\-right-margin=\fI[POS]\fP
Enable mark of right margin. Optional argument \fIPOS\fP is a margin position in characters. Default is 80.
.TP
.B \-\-brackets
Highlight matching brackets.
.TP
.B \-\-indent
Enable autoindent. This option also sets \fITAB\fP key as indent key.
.TP
.B \-\-smart-he=\fITYPE\fP
Set behavior of \fIHOME\fP and \fIEND\fP keys. The \fITYPE\fP is one of \fInewer\fP, \fIbefore\fP, \fIafter\fP or \fIalways\fP.
.TP
.B \-\-smart-bs
Enable smart mode for \fIBackSpace\fP. If this option is enabled BackSpace will delete spaces to the next tab position.
.TP
.B \-\-tab-width
Set tabulation step.
.TP
.B \-\-indent-width
Set indentation step.
.TP
.B \-\-spaces
Insert spaces instead of tabulation.
.PP
If \fIfontname\fP option is specified for text dialog, the description of font must be in CSS style (not in a Pango style).
Sending FormFeed character to text dialog clears it. This symbol may be sent as \fIecho \-e '\\f'\fP.
...
...
data/yad.gschema.xml.in
View file @
f7461944
...
...
@@ -106,7 +106,7 @@
<key name="smart-bs" type="b">
<default>false</default>
<_summary>Use smart backspace</_summary>
</key>
</key>
<key name="tab-width" type="i">
<default>8</default>
<_summary>Default tabulation width</_summary>
...
...
@@ -116,10 +116,6 @@
<_summary>Default indentation width</_summary>
</key>
<key name="spaces" type="b">
<default>false</default>
<_summary>Show space characters</_summary>
</key>
<key name="ins-spaces" type="b">
<default>true</default>
<_summary>Insert spaces instead of tabs</_summary>
</key>
...
...
po/ru.po
View file @
f7461944
This diff is collapsed.
Click to expand it.
po/uk.po
View file @
f7461944
This diff is collapsed.
Click to expand it.
src/main.c
View file @
f7461944
...
...
@@ -38,6 +38,7 @@ GtkIconTheme *yad_icon_theme;
#ifndef STANDALONE
GSettings
*
settings
;
GSettings
*
sv_settings
;
#endif
GdkPixbuf
*
big_fallback_image
=
NULL
;
...
...
@@ -702,6 +703,7 @@ main (gint argc, gchar ** argv)
#ifndef STANDALONE
settings
=
g_settings_new
(
"yad.settings"
);
sv_settings
=
g_settings_new
(
"yad.sourceview"
);
#endif
yad_icon_theme
=
gtk_icon_theme_get_default
();
...
...
src/option.c
View file @
f7461944
...
...
@@ -58,6 +58,7 @@ static gboolean set_size_format (const gchar *, const gchar *, gpointer, GError
static
gboolean
set_interp
(
const
gchar
*
,
const
gchar
*
,
gpointer
,
GError
**
);
#ifdef HAVE_SOURCEVIEW
static
gboolean
set_right_margin
(
const
gchar
*
,
const
gchar
*
,
gpointer
,
GError
**
);
static
gboolean
set_smart_homend
(
const
gchar
*
,
const
gchar
*
,
gpointer
,
GError
**
);
#endif
static
gboolean
about_mode
=
FALSE
;
...
...
@@ -676,6 +677,20 @@ static GOptionEntry source_options[] = {
N_
(
"Set color for second type marks"
),
N_
(
"COLOR"
)
},
{
"right-margin"
,
0
,
G_OPTION_FLAG_OPTIONAL_ARG
,
G_OPTION_ARG_CALLBACK
,
set_right_margin
,
N_
(
"Set position of right margin"
),
N_
(
"[POS]"
)
},
{
"brackets"
,
0
,
0
,
G_OPTION_ARG_NONE
,
&
options
.
source_data
.
brackets
,
N_
(
"Highlight matching brackets"
),
NULL
},
{
"indent"
,
0
,
0
,
G_OPTION_ARG_NONE
,
&
options
.
source_data
.
indent
,
N_
(
"Use autoindent"
),
NULL
},
{
"tab-width"
,
0
,
0
,
G_OPTION_ARG_INT
,
&
options
.
source_data
.
tab_width
,
N_
(
"Set tabulation width"
),
N_
(
"VALUE"
)
},
{
"indent-width"
,
0
,
0
,
G_OPTION_ARG_INT
,
&
options
.
source_data
.
indent_width
,
N_
(
"Set indentation width"
),
N_
(
"VALUE"
)
},
{
"smart-he"
,
0
,
0
,
G_OPTION_ARG_CALLBACK
,
set_smart_homend
,
N_
(
"Set smart Home/End behavior"
),
N_
(
"TYPE"
)
},
{
"smart-bs"
,
0
,
0
,
G_OPTION_ARG_NONE
,
&
options
.
source_data
.
smart_bs
,
N_
(
"Enable smart backspace"
),
NULL
},
{
"spaces"
,
0
,
0
,
G_OPTION_ARG_NONE
,
&
options
.
source_data
.
spaces
,
N_
(
"Insert spaces instead of tabs"
),
NULL
},
{
NULL
}
};
#endif
...
...
@@ -1334,6 +1349,23 @@ set_right_margin (const gchar * option_name, const gchar * value, gpointer data,
else
options
.
source_data
.
right_margin
=
RIGHT_MARGIN
;
}
static
gboolean
set_smart_homend
(
const
gchar
*
option_name
,
const
gchar
*
value
,
gpointer
data
,
GError
**
err
)
{
if
(
strcasecmp
(
value
,
"never"
)
==
0
)
options
.
source_data
.
smart_he
=
GTK_SOURCE_SMART_HOME_END_DISABLED
;
else
if
(
strcasecmp
(
value
,
"before"
)
==
0
)
options
.
source_data
.
smart_he
=
GTK_SOURCE_SMART_HOME_END_BEFORE
;
else
if
(
strcasecmp
(
value
,
"after"
)
==
0
)
options
.
source_data
.
smart_he
=
GTK_SOURCE_SMART_HOME_END_AFTER
;
else
if
(
strcasecmp
(
value
,
"always"
)
==
0
)
options
.
source_data
.
smart_he
=
GTK_SOURCE_SMART_HOME_END_ALWAYS
;
else
g_printerr
(
_
(
"Unknown smart Home/End mode: %s
\n
"
),
value
);
return
TRUE
;
}
#endif
#ifndef G_OS_WIN32
...
...
@@ -1833,18 +1865,37 @@ yad_options_init (void)
#ifdef HAVE_SOURCEVIEW
/* Initialize sourceview data */
options
.
source_data
.
lang
=
NULL
;
#ifndef STANDALONE
options
.
source_data
.
theme
=
g_settings_get_string
(
sv_settings
,
"theme"
);;
options
.
source_data
.
line_num
=
g_settings_get_boolean
(
sv_settings
,
"line-num"
);
options
.
source_data
.
line_hl
=
g_settings_get_boolean
(
sv_settings
,
"line-hl"
);
options
.
source_data
.
line_marks
=
g_settings_get_boolean
(
sv_settings
,
"line-marks"
);
options
.
source_data
.
m1_color
=
g_settings_get_string
(
sv_settings
,
"mark1-color"
);
options
.
source_data
.
m2_color
=
g_settings_get_string
(
sv_settings
,
"mark2-color"
);
options
.
source_data
.
right_margin
=
g_settings_get_int
(
sv_settings
,
"right-margin"
);
options
.
source_data
.
brackets
=
g_settings_get_boolean
(
sv_settings
,
"brackets"
);
options
.
source_data
.
indent
=
g_settings_get_boolean
(
sv_settings
,
"indent"
);
options
.
source_data
.
tab_width
=
g_settings_get_int
(
sv_settings
,
"tab-width"
);
options
.
source_data
.
indent_width
=
g_settings_get_int
(
sv_settings
,
"indent-width"
);
options
.
source_data
.
smart_he
=
g_settings_get_enum
(
sv_settings
,
"homend"
);
options
.
source_data
.
smart_bs
=
g_settings_get_boolean
(
sv_settings
,
"smart-bs"
);
options
.
source_data
.
spaces
=
g_settings_get_boolean
(
sv_settings
,
"spaces"
);
#else
options
.
source_data
.
theme
=
NULL
;
options
.
source_data
.
line_num
=
FALSE
;
options
.
source_data
.
line_hl
=
FALSE
;
options
.
source_data
.
line_marks
=
FALSE
;
#ifndef STANDALONE
options
.
source_data
.
m1_color
=
g_settings_get_string
(
settings
,
"mark1-color"
);
options
.
source_data
.
m2_color
=
g_settings_get_string
(
settings
,
"mark2-color"
);
#else
options
.
source_data
.
m1_color
=
MARK1_COLOR
;
options
.
source_data
.
m2_color
=
MARK2_COLOR
;
#endif
options
.
source_data
.
right_margin
=
0
;
options
.
source_data
.
brackets
=
FALSE
;
options
.
source_data
.
indent
=
FALSE
;
options
.
source_data
.
tab_width
=
8
;
options
.
source_data
.
indent_width
=
4
;
options
.
source_data
.
smart_he
=
GTK_SOURCE_SMART_HOME_END_DISABLED
;
options
.
source_data
.
smart_bs
=
FALSE
;
options
.
source_data
.
spaces
=
FALSE
;
#endif
#endif
}
...
...
src/text.c
View file @
f7461944
...
...
@@ -563,6 +563,18 @@ text_create_widget (GtkWidget * dlg)
gtk_source_view_set_show_right_margin
(
GTK_SOURCE_VIEW
(
text_view
),
TRUE
);
gtk_source_view_set_right_margin_position
(
GTK_SOURCE_VIEW
(
text_view
),
options
.
source_data
.
right_margin
);
}
if
(
options
.
source_data
.
indent
)
{
gtk_source_view_set_auto_indent
(
GTK_SOURCE_VIEW
(
text_view
),
TRUE
);
gtk_source_view_set_indent_on_tab
(
GTK_SOURCE_VIEW
(
text_view
),
TRUE
);
}
gtk_source_view_set_tab_width
(
GTK_SOURCE_VIEW
(
text_view
),
options
.
source_data
.
tab_width
);
gtk_source_view_set_indent_width
(
GTK_SOURCE_VIEW
(
text_view
),
options
.
source_data
.
indent_width
);
gtk_source_view_set_smart_home_end
(
GTK_SOURCE_VIEW
(
text_view
),
options
.
source_data
.
smart_he
);
gtk_source_view_set_smart_backspace
(
GTK_SOURCE_VIEW
(
text_view
),
options
.
source_data
.
smart_bs
);
gtk_source_view_set_insert_spaces_instead_of_tabs
(
GTK_SOURCE_VIEW
(
text_view
),
options
.
source_data
.
spaces
);
gtk_source_buffer_set_highlight_matching_brackets
(
GTK_SOURCE_BUFFER
(
text_buffer
),
options
.
source_data
.
brackets
);
#endif
#ifdef HAVE_SPELL
...
...
src/yad.h
View file @
f7461944
...
...
@@ -478,9 +478,16 @@ typedef struct {
gboolean
line_num
;
gboolean
line_hl
;
gboolean
line_marks
;
guint
right_margin
;
gchar
*
m1_color
;
gchar
*
m2_color
;
guint
right_margin
;
gboolean
brackets
;
gboolean
indent
;
gint
tab_width
;
gint
indent_width
;
GtkSourceSmartHomeEndType
smart_he
;
gboolean
smart_bs
;
gboolean
spaces
;
}
YadSourceData
;
#endif
...
...
@@ -578,6 +585,7 @@ extern GtkIconTheme *yad_icon_theme;
#ifndef STANDALONE
extern
GSettings
*
settings
;
extern
GSettings
*
sv_settings
;
#endif
extern
GdkPixbuf
*
big_fallback_image
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment