Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0cfd6d5

Browse files
committed
Preliminary results
1 parent9dab425 commit0cfd6d5

File tree

5 files changed

+38
-5
lines changed

5 files changed

+38
-5
lines changed

‎src/bin/psql/input.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,8 @@ gets_fromFile(FILE *source)
276276
for (VARNAME = current_history(); VARNAME != NULL; \
277277
VARNAME = use_prev_ ? previous_history() : next_history()) \
278278
{ \
279+
if (VARNAME -> line == NULL) \
280+
continue; \
279281
(void) 0
280282

281283
#defineEND_ITERATE_HISTORY() \
@@ -344,7 +346,9 @@ initializeInput(int flags)
344346

345347
/* these two things must be done in this order: */
346348
initialize_readline();
349+
#ifndefHAVE_WIN32_LIBEDIT
347350
rl_initialize();
351+
#endif
348352

349353
useHistory= true;
350354
using_history();
@@ -448,8 +452,10 @@ saveHistory(char *fname, int max_lines)
448452
#else/* don't have append support */
449453
{
450454
/* truncate what we have ... */
455+
#ifndefHAVE_WIN32_LIBEDIT
451456
if (max_lines >=0)
452457
stifle_history(max_lines);
458+
#endif
453459
/* ... and overwrite file. Tough luck for concurrent sessions. */
454460
errnum=write_history(fname);
455461
if (errnum==0)

‎src/bin/psql/print.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,11 +196,13 @@ extern void printQuery(const PGresult *result, const printQueryOpt *opt,
196196
externvoidsetDecimalLocale(void);
197197
externconstprintTextFormat*get_line_style(constprintTableOpt*opt);
198198
externvoidrefresh_utf8format(constprintTableOpt*opt);
199-
199+
/* Let build system to redefine default pager */
200+
#ifndefDEFAULT_PAGER
200201
#ifndef__CYGWIN__
201202
#defineDEFAULT_PAGER "more"
202203
#else
203204
#defineDEFAULT_PAGER "less"
204205
#endif
206+
#endif
205207

206208
#endif/* PRINT_H */

‎src/bin/psql/startup.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include"mainloop.h"
2929
#include"print.h"
3030
#include"settings.h"
31+
#include"mb/pg_wchar.h"
3132

3233

3334

@@ -95,6 +96,10 @@ main(int argc, char *argv[])
9596
boolnew_pass;
9697

9798
set_pglocale_pgservice(argv[0],PG_TEXTDOMAIN("psql"));
99+
#if defined(HAVE_WIN32_LIBEDIT)&& defined(ENABLE_NLS)
100+
bind_textdomain_codeset(PG_TEXTDOMAIN("psql"),"UTF-8");
101+
bind_textdomain_codeset(PG_TEXTDOMAIN("libpq"),"UTF-8");
102+
#endif
98103

99104
if (argc>1)
100105
{
@@ -144,7 +149,12 @@ main(int argc, char *argv[])
144149
pset.popt.topt.env_columns=getenv("COLUMNS") ?atoi(getenv("COLUMNS")) :0;
145150

146151
pset.notty= (!isatty(fileno(stdin))|| !isatty(fileno(stdout)));
147-
152+
#ifdefHAVE_WIN_32_LIBEDIT
153+
if (!pset.notty&&pset.encoding==PG_SQL_ASCII) {
154+
_setmode(_fileno(stdout),_O_U8TEXT);
155+
pset.encoding=PG_UTF8;
156+
}
157+
#endif
148158
pset.getPassword=TRI_DEFAULT;
149159

150160
EstablishVariableSpace();
@@ -222,7 +232,7 @@ main(int argc, char *argv[])
222232
keywords[5]="fallback_application_name";
223233
values[5]=pset.progname;
224234
keywords[6]="client_encoding";
225-
values[6]= (pset.notty||getenv("PGCLIENTENCODING")) ?NULL :"auto";
235+
values[6]= (pset.notty||getenv("PGCLIENTENCODING")) ?NULL :"UTF8";
226236
keywords[7]=NULL;
227237
values[7]=NULL;
228238

‎src/bin/psql/tab-complete.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -861,11 +861,12 @@ initialize_readline(void)
861861
{
862862
rl_readline_name= (char*)pset.progname;
863863
rl_attempted_completion_function=psql_completion;
864-
864+
#ifndefHAVE_WIN32_LIBEDIT
865865
rl_basic_word_break_characters=WORD_BREAKS;
866866

867+
/* In WinLibEdit rl_basic_word_break_characters is constant */
867868
completion_max_records=1000;
868-
869+
#endif
869870
/*
870871
* There is a variable rl_completion_query_items for this but apparently
871872
* it's not defined everywhere.

‎src/tools/msvc/Solution.pm

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,14 @@ s{PG_VERSION_STR "[^"]+"}{__STRINGIFY(x) #x\n#define __STRINGIFY2(z) __STRINGIFY
238238
{
239239
print O"#define USE_ICU\n";
240240
}
241+
if ($self->{options}->{libedit})
242+
{
243+
print O"#define HAVE_EDITLINE_READLINE_H\n";
244+
print O"#define HAVE_LIBREADLINE\n";
245+
print O"#define HAVE_WIN32_LIBEDIT\n";
246+
print O"#define HAVE_RL_FILENAME_COMPLETION_FUNCTION\n";
247+
print O"#define HAVE_RL_COMPLETION_MATCHES\n";
248+
}
241249
print O"#define VAL_CONFIGURE\""
242250
.$self->GetFakeConfigure() ."\"\n";
243251
print O"#endif /* IGNORE_CONFIGURED_SETTINGS */\n";
@@ -540,6 +548,12 @@ sub AddProject
540548
$proj->AddLibrary($libdir.'\icuin.lib');
541549
$proj->AddLibrary($libdir.'\icuuc.lib');
542550
}
551+
if ($self->{options}->{libedit})
552+
{
553+
$proj->AddIncludeDir($self->{options}->{libedit} .'\include');
554+
$proj->AddLibrary($self->{options}->{libedit} ."\\" .
555+
($self->{platform}eq'x64'?'lib64':'lib32').'\edit_static.lib');
556+
}
543557
return$proj;
544558
}
545559

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp