When using editor_get_eol_char_* functions with an invalid editor object, return the appropriate value according to the eol character preference (just in case).
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2999 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
a032d6a660
commit
f701893ef7
@ -9,6 +9,10 @@
|
||||
src/tools.c:
|
||||
Unify the API in editor.c, all public functions now take a
|
||||
GeanyEditor* object.
|
||||
* src/editor.c:
|
||||
When using editor_get_eol_char_* functions with an invalid editor
|
||||
object, return the appropriate value according to the eol character
|
||||
preference (just in case).
|
||||
|
||||
|
||||
2008-09-25 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
|
||||
|
24
src/editor.c
24
src/editor.c
@ -3445,10 +3445,12 @@ void editor_insert_color(GeanyEditor *editor, const gchar *colour)
|
||||
|
||||
const gchar *editor_get_eol_char_name(GeanyEditor *editor)
|
||||
{
|
||||
if (editor == NULL)
|
||||
return "";
|
||||
gint mode = file_prefs.default_eol_character;
|
||||
|
||||
switch (sci_get_eol_mode(editor->sci))
|
||||
if (editor != NULL)
|
||||
mode = sci_get_eol_mode(editor->sci);
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case SC_EOL_CRLF: return _("Win (CRLF)"); break;
|
||||
case SC_EOL_CR: return _("Mac (CR)"); break;
|
||||
@ -3460,10 +3462,12 @@ const gchar *editor_get_eol_char_name(GeanyEditor *editor)
|
||||
/* returns the end-of-line character(s) length of the specified editor */
|
||||
gint editor_get_eol_char_len(GeanyEditor *editor)
|
||||
{
|
||||
if (editor == NULL)
|
||||
return 0;
|
||||
gint mode = file_prefs.default_eol_character;
|
||||
|
||||
switch (sci_get_eol_mode(editor->sci))
|
||||
if (editor != NULL)
|
||||
mode = sci_get_eol_mode(editor->sci);
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case SC_EOL_CRLF: return 2; break;
|
||||
default: return 1; break;
|
||||
@ -3474,10 +3478,12 @@ gint editor_get_eol_char_len(GeanyEditor *editor)
|
||||
/* returns the end-of-line character(s) of the specified editor */
|
||||
const gchar *editor_get_eol_char(GeanyEditor *editor)
|
||||
{
|
||||
if (editor == NULL)
|
||||
return "";
|
||||
gint mode = file_prefs.default_eol_character;
|
||||
|
||||
switch (sci_get_eol_mode(editor->sci))
|
||||
if (editor != NULL)
|
||||
mode = sci_get_eol_mode(editor->sci);
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case SC_EOL_CRLF: return "\r\n"; break;
|
||||
case SC_EOL_CR: return "\r"; break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user