mirror of
https://github.com/zoriya/vim.git
synced 2026-01-03 04:48:15 +00:00
Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
12c22cee34 | ||
|
|
9439cdddf7 | ||
|
|
77ab2801c7 | ||
|
|
b9c1e96ce1 | ||
|
|
99133038dc | ||
|
|
798b30bdfd | ||
|
|
f3205d1ee7 | ||
|
|
1b636fa0e8 | ||
|
|
496c5267df | ||
|
|
80b6a0e8d5 | ||
|
|
c84e8952eb | ||
|
|
f4580d80e2 | ||
|
|
8281f44518 | ||
|
|
2bea291af0 | ||
|
|
f837ef9e7b | ||
|
|
552c8a5677 | ||
|
|
dd310301ec | ||
|
|
9d77dccb7f | ||
|
|
8e8fe9b2b8 |
@@ -2414,6 +2414,7 @@ cursor({list})
|
||||
When 'virtualedit' is used {off} specifies the offset in
|
||||
screen columns from the start of the character. E.g., a
|
||||
position within a <Tab> or after the last character.
|
||||
Returns 0 when the position could be set, -1 otherwise.
|
||||
|
||||
|
||||
deepcopy({expr}[, {noref}]) *deepcopy()* *E698*
|
||||
@@ -4516,6 +4517,7 @@ rename({from}, {to}) *rename()*
|
||||
should also work to move files across file systems. The
|
||||
result is a Number, which is 0 if the file was renamed
|
||||
successfully, and non-zero when the renaming failed.
|
||||
NOTE: If {to} exists it is overwritten without warning.
|
||||
This function is not available in the |sandbox|.
|
||||
|
||||
repeat({expr}, {count}) *repeat()*
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*if_cscop.txt* For Vim version 7.2. Last change: 2005 Mar 29
|
||||
*if_cscop.txt* For Vim version 7.2. Last change: 2009 Mar 18
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Andy Kahn
|
||||
@@ -131,11 +131,22 @@ The available subcommands are:
|
||||
7 or f: Find this file
|
||||
8 or i: Find files #including this file
|
||||
|
||||
For all types, except 4 and 6, leading white space for {name} is
|
||||
removed. For 4 and 6 there is exactly one space between {querytype}
|
||||
and {name}. Further white space is included in {name}.
|
||||
|
||||
EXAMPLES >
|
||||
:cscope find c vim_free
|
||||
:cscope find 3 vim_free
|
||||
:cscope find 3 vim_free
|
||||
<
|
||||
These two examples perform the same query. >
|
||||
These two examples perform the same query: functions calling
|
||||
"vim_free". >
|
||||
|
||||
:cscope find t initOnce
|
||||
:cscope find t initOnce
|
||||
<
|
||||
The first one searches for the text "initOnce", the second one for
|
||||
" initOnce". >
|
||||
|
||||
:cscope find 0 DEFAULT_TERM
|
||||
<
|
||||
|
||||
@@ -20,20 +20,21 @@ static char THIS_FILE[] = __FILE__;
|
||||
|
||||
static BOOL g_bEnableVim = TRUE; // Vim enabled
|
||||
static BOOL g_bDevStudioEditor = FALSE; // Open file in Dev Studio editor simultaneously
|
||||
static BOOL g_bNewTabs = FALSE;
|
||||
static int g_ChangeDir = CD_NONE; // CD after file open?
|
||||
|
||||
static void VimSetEnableState (BOOL bEnableState);
|
||||
static BOOL VimOpenFile (BSTR& FileName, long LineNr);
|
||||
static DISPID VimGetDispatchId (COleAutomationControl& VimOle, char* Method);
|
||||
static void VimErrDiag (COleAutomationControl& VimOle);
|
||||
static void VimChangeDir (COleAutomationControl& VimOle, DISPID DispatchId, BSTR& FileName);
|
||||
static void DebugMsg (char* Msg, char* Arg = NULL);
|
||||
static void VimSetEnableState(BOOL bEnableState);
|
||||
static BOOL VimOpenFile(BSTR& FileName, long LineNr);
|
||||
static DISPID VimGetDispatchId(COleAutomationControl& VimOle, char* Method);
|
||||
static void VimErrDiag(COleAutomationControl& VimOle);
|
||||
static void VimChangeDir(COleAutomationControl& VimOle, DISPID DispatchId, BSTR& FileName);
|
||||
static void DebugMsg(char* Msg, char* Arg = NULL);
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CCommands
|
||||
|
||||
CCommands::CCommands ()
|
||||
CCommands::CCommands()
|
||||
{
|
||||
// m_pApplication == NULL; M$ Code generation bug!!!
|
||||
m_pApplication = NULL;
|
||||
@@ -41,17 +42,17 @@ CCommands::CCommands ()
|
||||
m_pDebuggerEventsObj = NULL;
|
||||
}
|
||||
|
||||
CCommands::~CCommands ()
|
||||
CCommands::~CCommands()
|
||||
{
|
||||
ASSERT (m_pApplication != NULL);
|
||||
ASSERT(m_pApplication != NULL);
|
||||
if (m_pApplication)
|
||||
{
|
||||
m_pApplication->Release ();
|
||||
m_pApplication->Release();
|
||||
m_pApplication = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void CCommands::SetApplicationObject (IApplication * pApplication)
|
||||
void CCommands::SetApplicationObject(IApplication * pApplication)
|
||||
{
|
||||
// This function assumes pApplication has already been AddRef'd
|
||||
// for us, which CDSAddIn did in it's QueryInterface call
|
||||
@@ -61,55 +62,57 @@ void CCommands::SetApplicationObject (IApplication * pApplication)
|
||||
return;
|
||||
|
||||
// Create Application event handlers
|
||||
XApplicationEventsObj::CreateInstance (&m_pApplicationEventsObj);
|
||||
XApplicationEventsObj::CreateInstance(&m_pApplicationEventsObj);
|
||||
if (! m_pApplicationEventsObj)
|
||||
{
|
||||
ReportInternalError ("XApplicationEventsObj::CreateInstance");
|
||||
ReportInternalError("XApplicationEventsObj::CreateInstance");
|
||||
return;
|
||||
}
|
||||
m_pApplicationEventsObj->AddRef ();
|
||||
m_pApplicationEventsObj->Connect (m_pApplication);
|
||||
m_pApplicationEventsObj->AddRef();
|
||||
m_pApplicationEventsObj->Connect(m_pApplication);
|
||||
m_pApplicationEventsObj->m_pCommands = this;
|
||||
|
||||
#ifdef NEVER
|
||||
// Create Debugger event handler
|
||||
CComPtr < IDispatch > pDebugger;
|
||||
if (SUCCEEDED (m_pApplication->get_Debugger (&pDebugger))
|
||||
if (SUCCEEDED(m_pApplication->get_Debugger(&pDebugger))
|
||||
&& pDebugger != NULL)
|
||||
{
|
||||
XDebuggerEventsObj::CreateInstance (&m_pDebuggerEventsObj);
|
||||
m_pDebuggerEventsObj->AddRef ();
|
||||
m_pDebuggerEventsObj->Connect (pDebugger);
|
||||
XDebuggerEventsObj::CreateInstance(&m_pDebuggerEventsObj);
|
||||
m_pDebuggerEventsObj->AddRef();
|
||||
m_pDebuggerEventsObj->Connect(pDebugger);
|
||||
m_pDebuggerEventsObj->m_pCommands = this;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Get settings from registry HKEY_CURRENT_USER\Software\Vim\VisVim
|
||||
HKEY hAppKey = GetAppKey ("Vim");
|
||||
HKEY hAppKey = GetAppKey("Vim");
|
||||
if (hAppKey)
|
||||
{
|
||||
HKEY hSectionKey = GetSectionKey (hAppKey, "VisVim");
|
||||
HKEY hSectionKey = GetSectionKey(hAppKey, "VisVim");
|
||||
if (hSectionKey)
|
||||
{
|
||||
g_bEnableVim = GetRegistryInt (hSectionKey, "EnableVim",
|
||||
g_bEnableVim = GetRegistryInt(hSectionKey, "EnableVim",
|
||||
g_bEnableVim);
|
||||
g_bDevStudioEditor = GetRegistryInt(hSectionKey,"DevStudioEditor",
|
||||
g_bDevStudioEditor);
|
||||
g_ChangeDir = GetRegistryInt (hSectionKey, "ChangeDir",
|
||||
g_bDevStudioEditor = GetRegistryInt(hSectionKey,
|
||||
"DevStudioEditor", g_bDevStudioEditor);
|
||||
g_bNewTabs = GetRegistryInt(hSectionKey, "NewTabs",
|
||||
g_bNewTabs);
|
||||
g_ChangeDir = GetRegistryInt(hSectionKey, "ChangeDir",
|
||||
g_ChangeDir);
|
||||
RegCloseKey (hSectionKey);
|
||||
RegCloseKey(hSectionKey);
|
||||
}
|
||||
RegCloseKey (hAppKey);
|
||||
RegCloseKey(hAppKey);
|
||||
}
|
||||
}
|
||||
|
||||
void CCommands::UnadviseFromEvents ()
|
||||
void CCommands::UnadviseFromEvents()
|
||||
{
|
||||
ASSERT (m_pApplicationEventsObj != NULL);
|
||||
ASSERT(m_pApplicationEventsObj != NULL);
|
||||
if (m_pApplicationEventsObj)
|
||||
{
|
||||
m_pApplicationEventsObj->Disconnect (m_pApplication);
|
||||
m_pApplicationEventsObj->Release ();
|
||||
m_pApplicationEventsObj->Disconnect(m_pApplication);
|
||||
m_pApplicationEventsObj->Release();
|
||||
m_pApplicationEventsObj = NULL;
|
||||
}
|
||||
|
||||
@@ -121,10 +124,10 @@ void CCommands::UnadviseFromEvents ()
|
||||
// unadvise from its events (thus the VERIFY_OK below--see
|
||||
// stdafx.h).
|
||||
CComPtr < IDispatch > pDebugger;
|
||||
VERIFY_OK (m_pApplication->get_Debugger (&pDebugger));
|
||||
ASSERT (pDebugger != NULL);
|
||||
m_pDebuggerEventsObj->Disconnect (pDebugger);
|
||||
m_pDebuggerEventsObj->Release ();
|
||||
VERIFY_OK(m_pApplication->get_Debugger(&pDebugger));
|
||||
ASSERT(pDebugger != NULL);
|
||||
m_pDebuggerEventsObj->Disconnect(pDebugger);
|
||||
m_pDebuggerEventsObj->Release();
|
||||
m_pDebuggerEventsObj = NULL;
|
||||
}
|
||||
#endif
|
||||
@@ -136,21 +139,21 @@ void CCommands::UnadviseFromEvents ()
|
||||
|
||||
// Application events
|
||||
|
||||
HRESULT CCommands::XApplicationEvents::BeforeBuildStart ()
|
||||
HRESULT CCommands::XApplicationEvents::BeforeBuildStart()
|
||||
{
|
||||
AFX_MANAGE_STATE (AfxGetStaticModuleState ());
|
||||
AFX_MANAGE_STATE(AfxGetStaticModuleState());
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CCommands::XApplicationEvents::BuildFinish (long nNumErrors, long nNumWarnings)
|
||||
HRESULT CCommands::XApplicationEvents::BuildFinish(long nNumErrors, long nNumWarnings)
|
||||
{
|
||||
AFX_MANAGE_STATE (AfxGetStaticModuleState ());
|
||||
AFX_MANAGE_STATE(AfxGetStaticModuleState());
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CCommands::XApplicationEvents::BeforeApplicationShutDown ()
|
||||
HRESULT CCommands::XApplicationEvents::BeforeApplicationShutDown()
|
||||
{
|
||||
AFX_MANAGE_STATE (AfxGetStaticModuleState ());
|
||||
AFX_MANAGE_STATE(AfxGetStaticModuleState());
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -158,9 +161,9 @@ HRESULT CCommands::XApplicationEvents::BeforeApplicationShutDown ()
|
||||
// is done.
|
||||
// Vim gets called from here.
|
||||
//
|
||||
HRESULT CCommands::XApplicationEvents::DocumentOpen (IDispatch * theDocument)
|
||||
HRESULT CCommands::XApplicationEvents::DocumentOpen(IDispatch * theDocument)
|
||||
{
|
||||
AFX_MANAGE_STATE (AfxGetStaticModuleState ());
|
||||
AFX_MANAGE_STATE(AfxGetStaticModuleState());
|
||||
|
||||
if (! g_bEnableVim)
|
||||
// Vim not enabled or empty command line entered
|
||||
@@ -169,7 +172,7 @@ HRESULT CCommands::XApplicationEvents::DocumentOpen (IDispatch * theDocument)
|
||||
// First get the current file name and line number
|
||||
|
||||
// Get the document object
|
||||
CComQIPtr < ITextDocument, &IID_ITextDocument > pDoc (theDocument);
|
||||
CComQIPtr < ITextDocument, &IID_ITextDocument > pDoc(theDocument);
|
||||
if (! pDoc)
|
||||
return S_OK;
|
||||
|
||||
@@ -177,26 +180,26 @@ HRESULT CCommands::XApplicationEvents::DocumentOpen (IDispatch * theDocument)
|
||||
long LineNr = -1;
|
||||
|
||||
// Get the document name
|
||||
if (FAILED (pDoc->get_FullName (&FileName)))
|
||||
if (FAILED(pDoc->get_FullName(&FileName)))
|
||||
return S_OK;
|
||||
|
||||
LPDISPATCH pDispSel;
|
||||
|
||||
// Get a selection object dispatch pointer
|
||||
if (SUCCEEDED (pDoc->get_Selection (&pDispSel)))
|
||||
if (SUCCEEDED(pDoc->get_Selection(&pDispSel)))
|
||||
{
|
||||
// Get the selection object
|
||||
CComQIPtr < ITextSelection, &IID_ITextSelection > pSel (pDispSel);
|
||||
CComQIPtr < ITextSelection, &IID_ITextSelection > pSel(pDispSel);
|
||||
|
||||
if (pSel)
|
||||
// Get the selection line number
|
||||
pSel->get_CurrentLine (&LineNr);
|
||||
pSel->get_CurrentLine(&LineNr);
|
||||
|
||||
pDispSel->Release ();
|
||||
pDispSel->Release();
|
||||
}
|
||||
|
||||
// Open the file in Vim and position to the current line
|
||||
if (VimOpenFile (FileName, LineNr))
|
||||
if (VimOpenFile(FileName, LineNr))
|
||||
{
|
||||
if (! g_bDevStudioEditor)
|
||||
{
|
||||
@@ -204,30 +207,30 @@ HRESULT CCommands::XApplicationEvents::DocumentOpen (IDispatch * theDocument)
|
||||
CComVariant vSaveChanges = dsSaveChangesPrompt;
|
||||
DsSaveStatus Saved;
|
||||
|
||||
pDoc->Close (vSaveChanges, &Saved);
|
||||
pDoc->Close(vSaveChanges, &Saved);
|
||||
}
|
||||
}
|
||||
|
||||
// We're done here
|
||||
SysFreeString (FileName);
|
||||
SysFreeString(FileName);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CCommands::XApplicationEvents::BeforeDocumentClose (IDispatch * theDocument)
|
||||
HRESULT CCommands::XApplicationEvents::BeforeDocumentClose(IDispatch * theDocument)
|
||||
{
|
||||
AFX_MANAGE_STATE (AfxGetStaticModuleState ());
|
||||
AFX_MANAGE_STATE(AfxGetStaticModuleState());
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CCommands::XApplicationEvents::DocumentSave (IDispatch * theDocument)
|
||||
HRESULT CCommands::XApplicationEvents::DocumentSave(IDispatch * theDocument)
|
||||
{
|
||||
AFX_MANAGE_STATE (AfxGetStaticModuleState ());
|
||||
AFX_MANAGE_STATE(AfxGetStaticModuleState());
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CCommands::XApplicationEvents::NewDocument (IDispatch * theDocument)
|
||||
HRESULT CCommands::XApplicationEvents::NewDocument(IDispatch * theDocument)
|
||||
{
|
||||
AFX_MANAGE_STATE (AfxGetStaticModuleState ());
|
||||
AFX_MANAGE_STATE(AfxGetStaticModuleState());
|
||||
|
||||
if (! g_bEnableVim)
|
||||
// Vim not enabled or empty command line entered
|
||||
@@ -235,19 +238,19 @@ HRESULT CCommands::XApplicationEvents::NewDocument (IDispatch * theDocument)
|
||||
|
||||
// First get the current file name and line number
|
||||
|
||||
CComQIPtr < ITextDocument, &IID_ITextDocument > pDoc (theDocument);
|
||||
CComQIPtr < ITextDocument, &IID_ITextDocument > pDoc(theDocument);
|
||||
if (! pDoc)
|
||||
return S_OK;
|
||||
|
||||
BSTR FileName;
|
||||
HRESULT hr;
|
||||
|
||||
hr = pDoc->get_FullName (&FileName);
|
||||
if (FAILED (hr))
|
||||
hr = pDoc->get_FullName(&FileName);
|
||||
if (FAILED(hr))
|
||||
return S_OK;
|
||||
|
||||
// Open the file in Vim and position to the current line
|
||||
if (VimOpenFile (FileName, 0))
|
||||
if (VimOpenFile(FileName, 0))
|
||||
{
|
||||
if (! g_bDevStudioEditor)
|
||||
{
|
||||
@@ -255,49 +258,49 @@ HRESULT CCommands::XApplicationEvents::NewDocument (IDispatch * theDocument)
|
||||
CComVariant vSaveChanges = dsSaveChangesPrompt;
|
||||
DsSaveStatus Saved;
|
||||
|
||||
pDoc->Close (vSaveChanges, &Saved);
|
||||
pDoc->Close(vSaveChanges, &Saved);
|
||||
}
|
||||
}
|
||||
|
||||
SysFreeString (FileName);
|
||||
SysFreeString(FileName);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CCommands::XApplicationEvents::WindowActivate (IDispatch * theWindow)
|
||||
HRESULT CCommands::XApplicationEvents::WindowActivate(IDispatch * theWindow)
|
||||
{
|
||||
AFX_MANAGE_STATE (AfxGetStaticModuleState ());
|
||||
AFX_MANAGE_STATE(AfxGetStaticModuleState());
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CCommands::XApplicationEvents::WindowDeactivate (IDispatch * theWindow)
|
||||
HRESULT CCommands::XApplicationEvents::WindowDeactivate(IDispatch * theWindow)
|
||||
{
|
||||
AFX_MANAGE_STATE (AfxGetStaticModuleState ());
|
||||
AFX_MANAGE_STATE(AfxGetStaticModuleState());
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CCommands::XApplicationEvents::WorkspaceOpen ()
|
||||
HRESULT CCommands::XApplicationEvents::WorkspaceOpen()
|
||||
{
|
||||
AFX_MANAGE_STATE (AfxGetStaticModuleState ());
|
||||
AFX_MANAGE_STATE(AfxGetStaticModuleState());
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CCommands::XApplicationEvents::WorkspaceClose ()
|
||||
HRESULT CCommands::XApplicationEvents::WorkspaceClose()
|
||||
{
|
||||
AFX_MANAGE_STATE (AfxGetStaticModuleState ());
|
||||
AFX_MANAGE_STATE(AfxGetStaticModuleState());
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CCommands::XApplicationEvents::NewWorkspace ()
|
||||
HRESULT CCommands::XApplicationEvents::NewWorkspace()
|
||||
{
|
||||
AFX_MANAGE_STATE (AfxGetStaticModuleState ());
|
||||
AFX_MANAGE_STATE(AfxGetStaticModuleState());
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
// Debugger event
|
||||
|
||||
HRESULT CCommands::XDebuggerEvents::BreakpointHit (IDispatch * pBreakpoint)
|
||||
HRESULT CCommands::XDebuggerEvents::BreakpointHit(IDispatch * pBreakpoint)
|
||||
{
|
||||
AFX_MANAGE_STATE (AfxGetStaticModuleState ());
|
||||
AFX_MANAGE_STATE(AfxGetStaticModuleState());
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -308,17 +311,18 @@ HRESULT CCommands::XDebuggerEvents::BreakpointHit (IDispatch * pBreakpoint)
|
||||
class CMainDialog : public CDialog
|
||||
{
|
||||
public:
|
||||
CMainDialog (CWnd * pParent = NULL); // Standard constructor
|
||||
CMainDialog(CWnd * pParent = NULL); // Standard constructor
|
||||
|
||||
//{{AFX_DATA(CMainDialog)
|
||||
enum { IDD = IDD_ADDINMAIN };
|
||||
int m_ChangeDir;
|
||||
BOOL m_bDevStudioEditor;
|
||||
BOOL m_bNewTabs;
|
||||
//}}AFX_DATA
|
||||
|
||||
//{{AFX_VIRTUAL(CMainDialog)
|
||||
protected:
|
||||
virtual void DoDataExchange (CDataExchange * pDX); // DDX/DDV support
|
||||
virtual void DoDataExchange(CDataExchange * pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
protected:
|
||||
@@ -326,100 +330,106 @@ class CMainDialog : public CDialog
|
||||
afx_msg void OnEnable();
|
||||
afx_msg void OnDisable();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP ()
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
CMainDialog::CMainDialog (CWnd * pParent /* =NULL */ )
|
||||
: CDialog (CMainDialog::IDD, pParent)
|
||||
CMainDialog::CMainDialog(CWnd * pParent /* =NULL */ )
|
||||
: CDialog(CMainDialog::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CMainDialog)
|
||||
m_ChangeDir = -1;
|
||||
m_bDevStudioEditor = FALSE;
|
||||
m_bNewTabs = FALSE;
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
void CMainDialog::DoDataExchange (CDataExchange * pDX)
|
||||
void CMainDialog::DoDataExchange(CDataExchange * pDX)
|
||||
{
|
||||
CDialog::DoDataExchange (pDX);
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CMainDialog)
|
||||
DDX_Radio(pDX, IDC_CD_SOURCE_PATH, m_ChangeDir);
|
||||
DDX_Check (pDX, IDC_DEVSTUDIO_EDITOR, m_bDevStudioEditor);
|
||||
DDX_Check(pDX, IDC_DEVSTUDIO_EDITOR, m_bDevStudioEditor);
|
||||
DDX_Check(pDX, IDC_NEW_TABS, m_bNewTabs);
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
BEGIN_MESSAGE_MAP (CMainDialog, CDialog)
|
||||
BEGIN_MESSAGE_MAP(CMainDialog, CDialog)
|
||||
//{{AFX_MSG_MAP(CMainDialog)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP ()
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CCommands methods
|
||||
|
||||
STDMETHODIMP CCommands::VisVimDialog ()
|
||||
STDMETHODIMP CCommands::VisVimDialog()
|
||||
{
|
||||
AFX_MANAGE_STATE (AfxGetStaticModuleState ());
|
||||
AFX_MANAGE_STATE(AfxGetStaticModuleState());
|
||||
|
||||
// Use m_pApplication to access the Developer Studio Application
|
||||
// object,
|
||||
// and VERIFY_OK to see error strings in DEBUG builds of your add-in
|
||||
// (see stdafx.h)
|
||||
|
||||
VERIFY_OK (m_pApplication->EnableModeless (VARIANT_FALSE));
|
||||
VERIFY_OK(m_pApplication->EnableModeless(VARIANT_FALSE));
|
||||
|
||||
CMainDialog Dlg;
|
||||
|
||||
Dlg.m_bDevStudioEditor = g_bDevStudioEditor;
|
||||
Dlg.m_bNewTabs = g_bNewTabs;
|
||||
Dlg.m_ChangeDir = g_ChangeDir;
|
||||
if (Dlg.DoModal () == IDOK)
|
||||
if (Dlg.DoModal() == IDOK)
|
||||
{
|
||||
g_bDevStudioEditor = Dlg.m_bDevStudioEditor;
|
||||
g_bNewTabs = Dlg.m_bNewTabs;
|
||||
g_ChangeDir = Dlg.m_ChangeDir;
|
||||
|
||||
// Save settings to registry HKEY_CURRENT_USER\Software\Vim\VisVim
|
||||
HKEY hAppKey = GetAppKey ("Vim");
|
||||
HKEY hAppKey = GetAppKey("Vim");
|
||||
if (hAppKey)
|
||||
{
|
||||
HKEY hSectionKey = GetSectionKey (hAppKey, "VisVim");
|
||||
HKEY hSectionKey = GetSectionKey(hAppKey, "VisVim");
|
||||
if (hSectionKey)
|
||||
{
|
||||
WriteRegistryInt (hSectionKey, "DevStudioEditor",
|
||||
WriteRegistryInt(hSectionKey, "DevStudioEditor",
|
||||
g_bDevStudioEditor);
|
||||
WriteRegistryInt (hSectionKey, "ChangeDir", g_ChangeDir);
|
||||
RegCloseKey (hSectionKey);
|
||||
WriteRegistryInt(hSectionKey, "NewTabs",
|
||||
g_bNewTabs);
|
||||
WriteRegistryInt(hSectionKey, "ChangeDir", g_ChangeDir);
|
||||
RegCloseKey(hSectionKey);
|
||||
}
|
||||
RegCloseKey (hAppKey);
|
||||
RegCloseKey(hAppKey);
|
||||
}
|
||||
}
|
||||
|
||||
VERIFY_OK (m_pApplication->EnableModeless (VARIANT_TRUE));
|
||||
VERIFY_OK(m_pApplication->EnableModeless(VARIANT_TRUE));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CCommands::VisVimEnable ()
|
||||
STDMETHODIMP CCommands::VisVimEnable()
|
||||
{
|
||||
AFX_MANAGE_STATE (AfxGetStaticModuleState ());
|
||||
VimSetEnableState (true);
|
||||
AFX_MANAGE_STATE(AfxGetStaticModuleState());
|
||||
VimSetEnableState(true);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CCommands::VisVimDisable ()
|
||||
STDMETHODIMP CCommands::VisVimDisable()
|
||||
{
|
||||
AFX_MANAGE_STATE (AfxGetStaticModuleState ());
|
||||
VimSetEnableState (false);
|
||||
AFX_MANAGE_STATE(AfxGetStaticModuleState());
|
||||
VimSetEnableState(false);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CCommands::VisVimToggle ()
|
||||
STDMETHODIMP CCommands::VisVimToggle()
|
||||
{
|
||||
AFX_MANAGE_STATE (AfxGetStaticModuleState ());
|
||||
VimSetEnableState (! g_bEnableVim);
|
||||
AFX_MANAGE_STATE(AfxGetStaticModuleState());
|
||||
VimSetEnableState(! g_bEnableVim);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CCommands::VisVimLoad ()
|
||||
STDMETHODIMP CCommands::VisVimLoad()
|
||||
{
|
||||
AFX_MANAGE_STATE (AfxGetStaticModuleState ());
|
||||
AFX_MANAGE_STATE(AfxGetStaticModuleState());
|
||||
|
||||
// Use m_pApplication to access the Developer Studio Application object,
|
||||
// and VERIFY_OK to see error strings in DEBUG builds of your add-in
|
||||
@@ -430,7 +440,7 @@ STDMETHODIMP CCommands::VisVimLoad ()
|
||||
CComPtr < IDispatch > pDispDoc, pDispSel;
|
||||
|
||||
// Get a document object dispatch pointer
|
||||
VERIFY_OK (m_pApplication->get_ActiveDocument (&pDispDoc));
|
||||
VERIFY_OK(m_pApplication->get_ActiveDocument(&pDispDoc));
|
||||
if (! pDispDoc)
|
||||
return S_OK;
|
||||
|
||||
@@ -438,30 +448,30 @@ STDMETHODIMP CCommands::VisVimLoad ()
|
||||
long LineNr = -1;
|
||||
|
||||
// Get the document object
|
||||
CComQIPtr < ITextDocument, &IID_ITextDocument > pDoc (pDispDoc);
|
||||
CComQIPtr < ITextDocument, &IID_ITextDocument > pDoc(pDispDoc);
|
||||
|
||||
if (! pDoc)
|
||||
return S_OK;
|
||||
|
||||
// Get the document name
|
||||
if (FAILED (pDoc->get_FullName (&FileName)))
|
||||
if (FAILED(pDoc->get_FullName(&FileName)))
|
||||
return S_OK;
|
||||
|
||||
// Get a selection object dispatch pointer
|
||||
if (SUCCEEDED (pDoc->get_Selection (&pDispSel)))
|
||||
if (SUCCEEDED(pDoc->get_Selection(&pDispSel)))
|
||||
{
|
||||
// Get the selection object
|
||||
CComQIPtr < ITextSelection, &IID_ITextSelection > pSel (pDispSel);
|
||||
CComQIPtr < ITextSelection, &IID_ITextSelection > pSel(pDispSel);
|
||||
|
||||
if (pSel)
|
||||
// Get the selection line number
|
||||
pSel->get_CurrentLine (&LineNr);
|
||||
pSel->get_CurrentLine(&LineNr);
|
||||
}
|
||||
|
||||
// Open the file in Vim
|
||||
VimOpenFile (FileName, LineNr);
|
||||
VimOpenFile(FileName, LineNr);
|
||||
|
||||
SysFreeString (FileName);
|
||||
SysFreeString(FileName);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -472,16 +482,16 @@ STDMETHODIMP CCommands::VisVimLoad ()
|
||||
|
||||
// Set the enable state and save to registry
|
||||
//
|
||||
static void VimSetEnableState (BOOL bEnableState)
|
||||
static void VimSetEnableState(BOOL bEnableState)
|
||||
{
|
||||
g_bEnableVim = bEnableState;
|
||||
HKEY hAppKey = GetAppKey ("Vim");
|
||||
HKEY hAppKey = GetAppKey("Vim");
|
||||
if (hAppKey)
|
||||
{
|
||||
HKEY hSectionKey = GetSectionKey (hAppKey, "VisVim");
|
||||
HKEY hSectionKey = GetSectionKey(hAppKey, "VisVim");
|
||||
if (hSectionKey)
|
||||
WriteRegistryInt (hSectionKey, "EnableVim", g_bEnableVim);
|
||||
RegCloseKey (hAppKey);
|
||||
WriteRegistryInt(hSectionKey, "EnableVim", g_bEnableVim);
|
||||
RegCloseKey(hAppKey);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -490,7 +500,7 @@ static void VimSetEnableState (BOOL bEnableState)
|
||||
// letter.
|
||||
// 'LineNr' must contain a valid line number or 0, e. g. for a new file
|
||||
//
|
||||
static BOOL VimOpenFile (BSTR& FileName, long LineNr)
|
||||
static BOOL VimOpenFile(BSTR& FileName, long LineNr)
|
||||
{
|
||||
|
||||
// OLE automation object for com. with Vim
|
||||
@@ -507,7 +517,7 @@ static BOOL VimOpenFile (BSTR& FileName, long LineNr)
|
||||
// Get a dispatch id for the SendKeys method of Vim;
|
||||
// enables connection to Vim if necessary
|
||||
DISPID DispatchId;
|
||||
DispatchId = VimGetDispatchId (VimOle, "SendKeys");
|
||||
DispatchId = VimGetDispatchId(VimOle, "SendKeys");
|
||||
if (! DispatchId)
|
||||
// OLE error, can't obtain dispatch id
|
||||
goto OleError;
|
||||
@@ -525,20 +535,28 @@ static BOOL VimOpenFile (BSTR& FileName, long LineNr)
|
||||
#ifdef SINGLE_WINDOW
|
||||
// Update the current file in Vim if it has been modified.
|
||||
// Disabled, because it could write the file when you don't want to.
|
||||
sprintf (VimCmd + 2, ":up\n");
|
||||
sprintf(VimCmd + 2, ":up\n");
|
||||
#endif
|
||||
if (! VimOle.Method (DispatchId, "s", TO_OLE_STR_BUF (VimCmd, Buf)))
|
||||
if (! VimOle.Method(DispatchId, "s", TO_OLE_STR_BUF(VimCmd, Buf)))
|
||||
goto OleError;
|
||||
|
||||
// Change Vim working directory to where the file is if desired
|
||||
if (g_ChangeDir != CD_NONE)
|
||||
VimChangeDir (VimOle, DispatchId, FileName);
|
||||
VimChangeDir(VimOle, DispatchId, FileName);
|
||||
|
||||
// Make Vim open the file.
|
||||
// In the filename convert all \ to /, put a \ before a space.
|
||||
sprintf(VimCmd, ":drop ");
|
||||
if (g_bNewTabs)
|
||||
{
|
||||
sprintf(VimCmd, ":tab drop ");
|
||||
s = VimCmd + 11;
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(VimCmd, ":drop ");
|
||||
s = VimCmd + 6;
|
||||
}
|
||||
sprintf(FileNameTmp, "%S", (char *)FileName);
|
||||
s = VimCmd + 6;
|
||||
for (p = FileNameTmp; *p != '\0' && s < FileNameTmp + MAX_OLE_STR - 4;
|
||||
++p)
|
||||
if (*p == '\\')
|
||||
@@ -552,20 +570,20 @@ static BOOL VimOpenFile (BSTR& FileName, long LineNr)
|
||||
*s++ = '\n';
|
||||
*s = '\0';
|
||||
|
||||
if (! VimOle.Method (DispatchId, "s", TO_OLE_STR_BUF (VimCmd, Buf)))
|
||||
if (! VimOle.Method(DispatchId, "s", TO_OLE_STR_BUF(VimCmd, Buf)))
|
||||
goto OleError;
|
||||
|
||||
if (LineNr > 0)
|
||||
{
|
||||
// Goto line
|
||||
sprintf (VimCmd, ":%d\n", LineNr);
|
||||
if (! VimOle.Method (DispatchId, "s", TO_OLE_STR_BUF (VimCmd, Buf)))
|
||||
sprintf(VimCmd, ":%d\n", LineNr);
|
||||
if (! VimOle.Method(DispatchId, "s", TO_OLE_STR_BUF(VimCmd, Buf)))
|
||||
goto OleError;
|
||||
}
|
||||
|
||||
// Make Vim come to the foreground
|
||||
if (! VimOle.Method ("SetForeground"))
|
||||
VimOle.ErrDiag ();
|
||||
if (! VimOle.Method("SetForeground"))
|
||||
VimOle.ErrDiag();
|
||||
|
||||
// We're done
|
||||
return true;
|
||||
@@ -573,7 +591,7 @@ static BOOL VimOpenFile (BSTR& FileName, long LineNr)
|
||||
OleError:
|
||||
// There was an OLE error
|
||||
// Check if it's the "unknown class string" error
|
||||
VimErrDiag (VimOle);
|
||||
VimErrDiag(VimOle);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -581,18 +599,18 @@ static BOOL VimOpenFile (BSTR& FileName, long LineNr)
|
||||
// Create the Vim OLE object if necessary
|
||||
// Returns a valid dispatch id or null on error
|
||||
//
|
||||
static DISPID VimGetDispatchId (COleAutomationControl& VimOle, char* Method)
|
||||
static DISPID VimGetDispatchId(COleAutomationControl& VimOle, char* Method)
|
||||
{
|
||||
// Initialize Vim OLE connection if not already done
|
||||
if (! VimOle.IsCreated ())
|
||||
if (! VimOle.IsCreated())
|
||||
{
|
||||
if (! VimOle.CreateObject ("Vim.Application"))
|
||||
if (! VimOle.CreateObject("Vim.Application"))
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Get the dispatch id for the SendKeys method.
|
||||
// By doing this, we are checking if Vim is still there...
|
||||
DISPID DispatchId = VimOle.GetDispatchId ("SendKeys");
|
||||
DISPID DispatchId = VimOle.GetDispatchId("SendKeys");
|
||||
if (! DispatchId)
|
||||
{
|
||||
// We can't get a dispatch id.
|
||||
@@ -604,12 +622,12 @@ static DISPID VimGetDispatchId (COleAutomationControl& VimOle, char* Method)
|
||||
// should not be kept long enough to allow the user to terminate Vim
|
||||
// to avoid memory corruption (why the heck is there no system garbage
|
||||
// collection for those damned OLE memory chunks???).
|
||||
VimOle.DeleteObject ();
|
||||
if (! VimOle.CreateObject ("Vim.Application"))
|
||||
VimOle.DeleteObject();
|
||||
if (! VimOle.CreateObject("Vim.Application"))
|
||||
// If this create fails, it's time for an error msg
|
||||
return NULL;
|
||||
|
||||
if (! (DispatchId = VimOle.GetDispatchId ("SendKeys")))
|
||||
if (! (DispatchId = VimOle.GetDispatchId("SendKeys")))
|
||||
// There is something wrong...
|
||||
return NULL;
|
||||
}
|
||||
@@ -620,20 +638,20 @@ static DISPID VimGetDispatchId (COleAutomationControl& VimOle, char* Method)
|
||||
// Output an error message for an OLE error
|
||||
// Check on the classstring error, which probably means Vim wasn't registered.
|
||||
//
|
||||
static void VimErrDiag (COleAutomationControl& VimOle)
|
||||
static void VimErrDiag(COleAutomationControl& VimOle)
|
||||
{
|
||||
SCODE sc = GetScode (VimOle.GetResult ());
|
||||
SCODE sc = GetScode(VimOle.GetResult());
|
||||
if (sc == CO_E_CLASSSTRING)
|
||||
{
|
||||
char Buf[256];
|
||||
sprintf (Buf, "There is no registered OLE automation server named "
|
||||
sprintf(Buf, "There is no registered OLE automation server named "
|
||||
"\"Vim.Application\".\n"
|
||||
"Use the OLE-enabled version of Vim with VisVim and "
|
||||
"make sure to register Vim by running \"vim -register\".");
|
||||
MessageBox (NULL, Buf, "OLE Error", MB_OK);
|
||||
MessageBox(NULL, Buf, "OLE Error", MB_OK);
|
||||
}
|
||||
else
|
||||
VimOle.ErrDiag ();
|
||||
VimOle.ErrDiag();
|
||||
}
|
||||
|
||||
// Change directory to the directory the file 'FileName' is in or it's parent
|
||||
@@ -644,7 +662,7 @@ static void VimErrDiag (COleAutomationControl& VimOle)
|
||||
// CD_SOURCE_PATH
|
||||
// CD_SOURCE_PARENT
|
||||
//
|
||||
static void VimChangeDir (COleAutomationControl& VimOle, DISPID DispatchId, BSTR& FileName)
|
||||
static void VimChangeDir(COleAutomationControl& VimOle, DISPID DispatchId, BSTR& FileName)
|
||||
{
|
||||
// Do a :cd first
|
||||
|
||||
@@ -655,7 +673,7 @@ static void VimChangeDir (COleAutomationControl& VimOle, DISPID DispatchId, BSTR
|
||||
char DirUnix[_MAX_DIR * 2];
|
||||
char *s, *t;
|
||||
|
||||
_splitpath (StrFileName, Drive, Dir, NULL, NULL);
|
||||
_splitpath(StrFileName, Drive, Dir, NULL, NULL);
|
||||
|
||||
// Convert to Unix path name format, escape spaces.
|
||||
t = DirUnix;
|
||||
@@ -676,19 +694,18 @@ static void VimChangeDir (COleAutomationControl& VimOle, DISPID DispatchId, BSTR
|
||||
OLECHAR Buf[MAX_OLE_STR];
|
||||
char VimCmd[MAX_OLE_STR];
|
||||
|
||||
sprintf (VimCmd, ":cd %s%s%s\n", Drive, DirUnix,
|
||||
sprintf(VimCmd, ":cd %s%s%s\n", Drive, DirUnix,
|
||||
g_ChangeDir == CD_SOURCE_PARENT && DirUnix[1] ? ".." : "");
|
||||
VimOle.Method (DispatchId, "s", TO_OLE_STR_BUF (VimCmd, Buf));
|
||||
VimOle.Method(DispatchId, "s", TO_OLE_STR_BUF(VimCmd, Buf));
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
// Print out a debug message
|
||||
//
|
||||
static void DebugMsg (char* Msg, char* Arg)
|
||||
static void DebugMsg(char* Msg, char* Arg)
|
||||
{
|
||||
char Buf[400];
|
||||
sprintf (Buf, Msg, Arg);
|
||||
AfxMessageBox (Buf);
|
||||
sprintf(Buf, Msg, Arg);
|
||||
AfxMessageBox(Buf);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#define IDC_CD_SOURCE_PATH 1001
|
||||
#define IDC_CD_SOURCE_PARENT 1002
|
||||
#define IDC_CD_NONE 1003
|
||||
#define IDC_NEW_TABS 1004
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
|
||||
@@ -122,6 +122,9 @@ BEGIN
|
||||
CONTROL "&Open file in DevStudio editor simultaneously",
|
||||
IDC_DEVSTUDIO_EDITOR,"Button",BS_AUTOCHECKBOX | WS_GROUP |
|
||||
WS_TABSTOP,7,7,153,10
|
||||
CONTROL "Open files in new tabs",
|
||||
IDC_NEW_TABS,"Button",BS_AUTOCHECKBOX | WS_GROUP |
|
||||
WS_TABSTOP,7,21,153,10
|
||||
GROUPBOX "Current directory",IDC_STATIC,7,35,164,58,WS_GROUP
|
||||
CONTROL "Set to &source file path",IDC_CD_SOURCE_PATH,"Button",
|
||||
BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,17,49,85,10
|
||||
|
||||
104
src/eval.c
104
src/eval.c
@@ -1285,7 +1285,9 @@ eval_to_string(arg, nextcmd, convert)
|
||||
typval_T tv;
|
||||
char_u *retval;
|
||||
garray_T ga;
|
||||
#ifdef FEAT_FLOAT
|
||||
char_u numbuf[NUMBUFLEN];
|
||||
#endif
|
||||
|
||||
if (eval0(arg, &tv, nextcmd, TRUE) == FAIL)
|
||||
retval = NULL;
|
||||
@@ -8018,7 +8020,8 @@ call_func(name, len, rettv, argcount, argvars, firstline, lastline,
|
||||
/* execute the function if no errors detected and executing */
|
||||
if (evaluate && error == ERROR_NONE)
|
||||
{
|
||||
rettv->v_type = VAR_NUMBER; /* default is number rettv */
|
||||
rettv->v_type = VAR_NUMBER; /* default rettv is number zero */
|
||||
rettv->vval.v_number = 0;
|
||||
error = ERROR_UNKNOWN;
|
||||
|
||||
if (!builtin_function(fname))
|
||||
@@ -8268,7 +8271,6 @@ f_append(argvars, rettv)
|
||||
return;
|
||||
li = l->lv_first;
|
||||
}
|
||||
rettv->vval.v_number = 0; /* Default: Success */
|
||||
for (;;)
|
||||
{
|
||||
if (l == NULL)
|
||||
@@ -8728,7 +8730,6 @@ f_call(argvars, rettv)
|
||||
int dummy;
|
||||
dict_T *selfdict = NULL;
|
||||
|
||||
rettv->vval.v_number = 0;
|
||||
if (argvars[1].v_type != VAR_LIST)
|
||||
{
|
||||
EMSG(_(e_listreq));
|
||||
@@ -9036,13 +9037,9 @@ f_confirm(argvars, rettv)
|
||||
if (buttons == NULL || *buttons == NUL)
|
||||
buttons = (char_u *)_("&Ok");
|
||||
|
||||
if (error)
|
||||
rettv->vval.v_number = 0;
|
||||
else
|
||||
if (!error)
|
||||
rettv->vval.v_number = do_dialog(type, NULL, message, buttons,
|
||||
def, NULL);
|
||||
#else
|
||||
rettv->vval.v_number = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -9181,15 +9178,14 @@ f_cscope_connection(argvars, rettv)
|
||||
}
|
||||
|
||||
rettv->vval.v_number = cs_connection(num, dbpath, prepend);
|
||||
#else
|
||||
rettv->vval.v_number = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* "cursor(lnum, col)" function
|
||||
*
|
||||
* Moves the cursor to the specified line and column
|
||||
* Moves the cursor to the specified line and column.
|
||||
* Returns 0 when the position could be set, -1 otherwise.
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
static void
|
||||
@@ -9202,6 +9198,7 @@ f_cursor(argvars, rettv)
|
||||
long coladd = 0;
|
||||
#endif
|
||||
|
||||
rettv->vval.v_number = -1;
|
||||
if (argvars[1].v_type == VAR_UNKNOWN)
|
||||
{
|
||||
pos_T pos;
|
||||
@@ -9246,6 +9243,7 @@ f_cursor(argvars, rettv)
|
||||
#endif
|
||||
|
||||
curwin->w_set_curswant = TRUE;
|
||||
rettv->vval.v_number = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -9291,8 +9289,6 @@ f_did_filetype(argvars, rettv)
|
||||
{
|
||||
#ifdef FEAT_AUTOCMD
|
||||
rettv->vval.v_number = did_filetype;
|
||||
#else
|
||||
rettv->vval.v_number = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -9605,7 +9601,6 @@ f_extend(argvars, rettv)
|
||||
typval_T *argvars;
|
||||
typval_T *rettv;
|
||||
{
|
||||
rettv->vval.v_number = 0;
|
||||
if (argvars[0].v_type == VAR_LIST && argvars[1].v_type == VAR_LIST)
|
||||
{
|
||||
list_T *l1, *l2;
|
||||
@@ -9733,7 +9728,6 @@ f_feedkeys(argvars, rettv)
|
||||
if (check_secure())
|
||||
return;
|
||||
|
||||
rettv->vval.v_number = 0;
|
||||
keys = get_tv_string(&argvars[0]);
|
||||
if (*keys != NUL)
|
||||
{
|
||||
@@ -9901,7 +9895,6 @@ filter_map(argvars, rettv, map)
|
||||
char_u *ermsg = map ? (char_u *)"map()" : (char_u *)"filter()";
|
||||
int save_did_emsg;
|
||||
|
||||
rettv->vval.v_number = 0;
|
||||
if (argvars[0].v_type == VAR_LIST)
|
||||
{
|
||||
if ((l = argvars[0].vval.v_list) == NULL
|
||||
@@ -10084,8 +10077,6 @@ f_float2nr(argvars, rettv)
|
||||
else
|
||||
rettv->vval.v_number = (varnumber_T)f;
|
||||
}
|
||||
else
|
||||
rettv->vval.v_number = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -10219,9 +10210,7 @@ f_foldlevel(argvars, rettv)
|
||||
lnum = get_tv_lnum(argvars);
|
||||
if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count)
|
||||
rettv->vval.v_number = foldLevel(lnum);
|
||||
else
|
||||
#endif
|
||||
rettv->vval.v_number = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -10337,7 +10326,6 @@ f_foreground(argvars, rettv)
|
||||
typval_T *argvars;
|
||||
typval_T *rettv;
|
||||
{
|
||||
rettv->vval.v_number = 0;
|
||||
#ifdef FEAT_GUI
|
||||
if (gui.in_use)
|
||||
gui_mch_set_foreground();
|
||||
@@ -10359,7 +10347,6 @@ f_function(argvars, rettv)
|
||||
{
|
||||
char_u *s;
|
||||
|
||||
rettv->vval.v_number = 0;
|
||||
s = get_tv_string(&argvars[0]);
|
||||
if (s == NULL || *s == NUL || VIM_ISDIGIT(*s))
|
||||
EMSG2(_(e_invarg2), s);
|
||||
@@ -10429,9 +10416,7 @@ f_get(argvars, rettv)
|
||||
|
||||
if (tv == NULL)
|
||||
{
|
||||
if (argvars[2].v_type == VAR_UNKNOWN)
|
||||
rettv->vval.v_number = 0;
|
||||
else
|
||||
if (argvars[2].v_type != VAR_UNKNOWN)
|
||||
copy_tv(&argvars[2], rettv);
|
||||
}
|
||||
else
|
||||
@@ -10456,13 +10441,8 @@ get_buffer_lines(buf, start, end, retlist, rettv)
|
||||
{
|
||||
char_u *p;
|
||||
|
||||
if (retlist)
|
||||
{
|
||||
if (rettv_list_alloc(rettv) == FAIL)
|
||||
return;
|
||||
}
|
||||
else
|
||||
rettv->vval.v_number = 0;
|
||||
if (retlist && rettv_list_alloc(rettv) == FAIL)
|
||||
return;
|
||||
|
||||
if (buf == NULL || buf->b_ml.ml_mfp == NULL || start < 0)
|
||||
return;
|
||||
@@ -11009,8 +10989,6 @@ f_getmatches(argvars, rettv)
|
||||
dict_T *dict;
|
||||
matchitem_T *cur = curwin->w_match_head;
|
||||
|
||||
rettv->vval.v_number = 0;
|
||||
|
||||
if (rettv_list_alloc(rettv) == OK)
|
||||
{
|
||||
while (cur != NULL)
|
||||
@@ -11089,7 +11067,6 @@ f_getqflist(argvars, rettv)
|
||||
win_T *wp;
|
||||
#endif
|
||||
|
||||
rettv->vval.v_number = 0;
|
||||
#ifdef FEAT_QUICKFIX
|
||||
if (rettv_list_alloc(rettv) == OK)
|
||||
{
|
||||
@@ -11935,7 +11912,6 @@ f_has_key(argvars, rettv)
|
||||
typval_T *argvars;
|
||||
typval_T *rettv;
|
||||
{
|
||||
rettv->vval.v_number = 0;
|
||||
if (argvars[0].v_type != VAR_DICT)
|
||||
{
|
||||
EMSG(_(e_dictreq));
|
||||
@@ -12052,8 +12028,6 @@ f_histdel(argvars, rettv)
|
||||
n = del_history_entry(get_histtype(str),
|
||||
get_tv_string_buf(&argvars[1], buf));
|
||||
rettv->vval.v_number = n;
|
||||
#else
|
||||
rettv->vval.v_number = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -12415,7 +12389,6 @@ f_inputlist(argvars, rettv)
|
||||
int selected;
|
||||
int mouse_used;
|
||||
|
||||
rettv->vval.v_number = 0;
|
||||
#ifdef NO_CONSOLE_INPUT
|
||||
/* While starting up, there is no place to enter text. */
|
||||
if (no_console_input())
|
||||
@@ -12464,7 +12437,7 @@ f_inputrestore(argvars, rettv)
|
||||
--ga_userinput.ga_len;
|
||||
restore_typeahead((tasave_T *)(ga_userinput.ga_data)
|
||||
+ ga_userinput.ga_len);
|
||||
rettv->vval.v_number = 0; /* OK */
|
||||
/* default return is zero == OK */
|
||||
}
|
||||
else if (p_verbose > 1)
|
||||
{
|
||||
@@ -12488,7 +12461,7 @@ f_inputsave(argvars, rettv)
|
||||
save_typeahead((tasave_T *)(ga_userinput.ga_data)
|
||||
+ ga_userinput.ga_len);
|
||||
++ga_userinput.ga_len;
|
||||
rettv->vval.v_number = 0; /* OK */
|
||||
/* default return is zero == OK */
|
||||
}
|
||||
else
|
||||
rettv->vval.v_number = 1; /* Failed */
|
||||
@@ -12522,7 +12495,6 @@ f_insert(argvars, rettv)
|
||||
list_T *l;
|
||||
int error = FALSE;
|
||||
|
||||
rettv->vval.v_number = 0;
|
||||
if (argvars[0].v_type != VAR_LIST)
|
||||
EMSG2(_(e_listarg), "insert()");
|
||||
else if ((l = argvars[0].vval.v_list) != NULL
|
||||
@@ -12641,7 +12613,6 @@ dict_list(argvars, rettv, what)
|
||||
dict_T *d;
|
||||
int todo;
|
||||
|
||||
rettv->vval.v_number = 0;
|
||||
if (argvars[0].v_type != VAR_DICT)
|
||||
{
|
||||
EMSG(_(e_dictreq));
|
||||
@@ -12729,7 +12700,6 @@ f_join(argvars, rettv)
|
||||
garray_T ga;
|
||||
char_u *sep;
|
||||
|
||||
rettv->vval.v_number = 0;
|
||||
if (argvars[0].v_type != VAR_LIST)
|
||||
{
|
||||
EMSG(_(e_listreq));
|
||||
@@ -12827,9 +12797,7 @@ libcall_common(argvars, rettv, type)
|
||||
#endif
|
||||
|
||||
rettv->v_type = type;
|
||||
if (type == VAR_NUMBER)
|
||||
rettv->vval.v_number = 0;
|
||||
else
|
||||
if (type != VAR_NUMBER)
|
||||
rettv->vval.v_string = NULL;
|
||||
|
||||
if (check_restricted() || check_secure())
|
||||
@@ -13770,7 +13738,6 @@ f_pumvisible(argvars, rettv)
|
||||
typval_T *argvars;
|
||||
typval_T *rettv;
|
||||
{
|
||||
rettv->vval.v_number = 0;
|
||||
#ifdef FEAT_INS_EXPAND
|
||||
if (pum_visible())
|
||||
rettv->vval.v_number = 1;
|
||||
@@ -13804,7 +13771,6 @@ f_range(argvars, rettv)
|
||||
stride = get_tv_number_chk(&argvars[2], &error);
|
||||
}
|
||||
|
||||
rettv->vval.v_number = 0;
|
||||
if (error)
|
||||
return; /* type error; errmsg already given */
|
||||
if (stride == 0)
|
||||
@@ -14193,7 +14159,6 @@ f_remote_foreground(argvars, rettv)
|
||||
typval_T *argvars;
|
||||
typval_T *rettv;
|
||||
{
|
||||
rettv->vval.v_number = 0;
|
||||
#ifdef FEAT_CLIENTSERVER
|
||||
# ifdef WIN32
|
||||
/* On Win32 it's done in this application. */
|
||||
@@ -14249,7 +14214,6 @@ f_remote_peek(argvars, rettv)
|
||||
rettv->vval.v_number = (s != NULL);
|
||||
}
|
||||
# else
|
||||
rettv->vval.v_number = 0;
|
||||
if (check_connection() == FAIL)
|
||||
return;
|
||||
|
||||
@@ -14338,7 +14302,6 @@ f_remove(argvars, rettv)
|
||||
dict_T *d;
|
||||
dictitem_T *di;
|
||||
|
||||
rettv->vval.v_number = 0;
|
||||
if (argvars[0].v_type == VAR_DICT)
|
||||
{
|
||||
if (argvars[2].v_type != VAR_UNKNOWN)
|
||||
@@ -14696,7 +14659,6 @@ f_reverse(argvars, rettv)
|
||||
list_T *l;
|
||||
listitem_T *li, *ni;
|
||||
|
||||
rettv->vval.v_number = 0;
|
||||
if (argvars[0].v_type != VAR_LIST)
|
||||
EMSG2(_(e_listarg), "reverse()");
|
||||
else if ((l = argvars[0].vval.v_list) != NULL
|
||||
@@ -15048,8 +15010,6 @@ f_searchpairpos(argvars, rettv)
|
||||
int lnum = 0;
|
||||
int col = 0;
|
||||
|
||||
rettv->vval.v_number = 0;
|
||||
|
||||
if (rettv_list_alloc(rettv) == FAIL)
|
||||
return;
|
||||
|
||||
@@ -15236,8 +15196,6 @@ f_searchpos(argvars, rettv)
|
||||
int n;
|
||||
int flags = 0;
|
||||
|
||||
rettv->vval.v_number = 0;
|
||||
|
||||
if (rettv_list_alloc(rettv) == FAIL)
|
||||
return;
|
||||
|
||||
@@ -15323,8 +15281,6 @@ f_setbufvar(argvars, rettv)
|
||||
typval_T *varp;
|
||||
char_u nbuf[NUMBUFLEN];
|
||||
|
||||
rettv->vval.v_number = 0;
|
||||
|
||||
if (check_restricted() || check_secure())
|
||||
return;
|
||||
(void)get_tv_number(&argvars[0]); /* issue errmsg if type error */
|
||||
@@ -15404,7 +15360,7 @@ f_setline(argvars, rettv)
|
||||
else
|
||||
line = get_tv_string_chk(&argvars[1]);
|
||||
|
||||
rettv->vval.v_number = 0; /* OK */
|
||||
/* default result is zero == OK */
|
||||
for (;;)
|
||||
{
|
||||
if (l != NULL)
|
||||
@@ -15717,6 +15673,7 @@ f_setwinvar(argvars, rettv)
|
||||
/*
|
||||
* "setwinvar()" and "settabwinvar()" functions
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
static void
|
||||
setwinvar(argvars, rettv, off)
|
||||
typval_T *argvars;
|
||||
@@ -15733,8 +15690,6 @@ setwinvar(argvars, rettv, off)
|
||||
char_u nbuf[NUMBUFLEN];
|
||||
tabpage_T *tp;
|
||||
|
||||
rettv->vval.v_number = 0;
|
||||
|
||||
if (check_restricted() || check_secure())
|
||||
return;
|
||||
|
||||
@@ -15947,7 +15902,6 @@ f_sort(argvars, rettv)
|
||||
long len;
|
||||
long i;
|
||||
|
||||
rettv->vval.v_number = 0;
|
||||
if (argvars[0].v_type != VAR_LIST)
|
||||
EMSG2(_(e_listarg), "sort()");
|
||||
else
|
||||
@@ -16870,9 +16824,7 @@ f_tabpagebuflist(argvars, rettv)
|
||||
typval_T *argvars;
|
||||
typval_T *rettv;
|
||||
{
|
||||
#ifndef FEAT_WINDOWS
|
||||
rettv->vval.v_number = 0;
|
||||
#else
|
||||
#ifdef FEAT_WINDOWS
|
||||
tabpage_T *tp;
|
||||
win_T *wp = NULL;
|
||||
|
||||
@@ -16884,19 +16836,12 @@ f_tabpagebuflist(argvars, rettv)
|
||||
if (tp != NULL)
|
||||
wp = (tp == curtab) ? firstwin : tp->tp_firstwin;
|
||||
}
|
||||
if (wp == NULL)
|
||||
rettv->vval.v_number = 0;
|
||||
else
|
||||
if (wp != NULL && rettv_list_alloc(rettv) != FAIL)
|
||||
{
|
||||
if (rettv_list_alloc(rettv) == FAIL)
|
||||
rettv->vval.v_number = 0;
|
||||
else
|
||||
{
|
||||
for (; wp != NULL; wp = wp->w_next)
|
||||
if (list_append_number(rettv->vval.v_list,
|
||||
for (; wp != NULL; wp = wp->w_next)
|
||||
if (list_append_number(rettv->vval.v_list,
|
||||
wp->w_buffer->b_fnum) == FAIL)
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -17024,10 +16969,7 @@ f_tagfiles(argvars, rettv)
|
||||
int first;
|
||||
|
||||
if (rettv_list_alloc(rettv) == FAIL)
|
||||
{
|
||||
rettv->vval.v_number = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
for (first = TRUE; ; first = FALSE)
|
||||
if (get_tagfname(&tn, first, fname) == FAIL
|
||||
@@ -17401,8 +17343,6 @@ f_visualmode(argvars, rettv)
|
||||
/* A non-zero number or non-empty string argument: reset mode. */
|
||||
if (non_zero_arg(&argvars[0]))
|
||||
curbuf->b_visual_mode_eval = NUL;
|
||||
#else
|
||||
rettv->vval.v_number = 0; /* return anything, it won't work anyway */
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -2699,6 +2699,11 @@ doend:
|
||||
/* Restore msg_scroll, it's set by file I/O commands, even when no
|
||||
* message is actually displayed. */
|
||||
msg_scroll = save_msg_scroll;
|
||||
|
||||
/* "silent reg" or "silent echo x" inside "redir" leaves msg_col
|
||||
* somewhere in the line. Put it back in the first column. */
|
||||
if (redirecting())
|
||||
msg_col = 0;
|
||||
}
|
||||
|
||||
#ifdef HAVE_SANDBOX
|
||||
@@ -3683,6 +3688,11 @@ set_one_cmd_context(xp, buff)
|
||||
case CMD_highlight:
|
||||
set_context_in_highlight_cmd(xp, arg);
|
||||
break;
|
||||
#ifdef FEAT_CSCOPE
|
||||
case CMD_cscope:
|
||||
set_context_in_cscope_cmd(xp, arg);
|
||||
break;
|
||||
#endif
|
||||
#ifdef FEAT_LISTCMDS
|
||||
case CMD_bdelete:
|
||||
case CMD_bwipeout:
|
||||
@@ -5187,6 +5197,9 @@ static struct
|
||||
{EXPAND_AUGROUP, "augroup"},
|
||||
{EXPAND_BUFFERS, "buffer"},
|
||||
{EXPAND_COMMANDS, "command"},
|
||||
#if defined(FEAT_CSCOPE)
|
||||
{EXPAND_CSCOPE, "cscope"},
|
||||
#endif
|
||||
#if defined(FEAT_EVAL) && defined(FEAT_CMDL_COMPL)
|
||||
{EXPAND_USER_DEFINED, "custom"},
|
||||
{EXPAND_USER_LIST, "customlist"},
|
||||
@@ -7875,6 +7888,10 @@ ex_cd(eap)
|
||||
else
|
||||
#endif
|
||||
{
|
||||
#ifdef FEAT_AUTOCMD
|
||||
if (allbuf_locked())
|
||||
return;
|
||||
#endif
|
||||
if (vim_strchr(p_cpo, CPO_CHDIR) != NULL && curbufIsChanged()
|
||||
&& !eap->forceit)
|
||||
{
|
||||
|
||||
@@ -4518,6 +4518,9 @@ ExpandFromContext(xp, pat, num_file, file, options)
|
||||
{EXPAND_EVENTS, get_event_name, TRUE},
|
||||
{EXPAND_AUGROUP, get_augroup_name, TRUE},
|
||||
#endif
|
||||
#ifdef FEAT_CSCOPE
|
||||
{EXPAND_CSCOPE, get_cscope_name, TRUE},
|
||||
#endif
|
||||
#if (defined(HAVE_LOCALE_H) || defined(X_LOCALE)) \
|
||||
&& (defined(FEAT_GETTEXT) || defined(FEAT_MBYTE))
|
||||
{EXPAND_LANGUAGE, get_lang_arg, TRUE},
|
||||
@@ -5683,7 +5686,7 @@ ex_history(eap)
|
||||
histype1 = get_histtype(arg);
|
||||
if (histype1 == -1)
|
||||
{
|
||||
if (STRICMP(arg, "all") == 0)
|
||||
if (STRNICMP(arg, "all", STRLEN(arg)) == 0)
|
||||
{
|
||||
histype1 = 0;
|
||||
histype2 = HIST_COUNT-1;
|
||||
|
||||
@@ -6647,6 +6647,11 @@ buf_check_timestamp(buf, focus)
|
||||
tbuf = alloc((unsigned)(STRLEN(path) + STRLEN(mesg)
|
||||
+ STRLEN(mesg2) + 2));
|
||||
sprintf((char *)tbuf, mesg, path);
|
||||
#ifdef FEAT_EVAL
|
||||
/* Set warningmsg here, before the unimportant and output-specific
|
||||
* mesg2 has been appended. */
|
||||
set_vim_var_string(VV_WARNINGMSG, tbuf, -1);
|
||||
#endif
|
||||
#if defined(FEAT_CON_DIALOG) || defined(FEAT_GUI_DIALOG)
|
||||
if (can_reload)
|
||||
{
|
||||
|
||||
@@ -1291,6 +1291,23 @@ drawBalloon(beval)
|
||||
XtNy, ty,
|
||||
NULL);
|
||||
#endif
|
||||
/* Set tooltip colors */
|
||||
{
|
||||
Arg args[2];
|
||||
|
||||
#ifdef FEAT_GUI_MOTIF
|
||||
args[0].name = XmNbackground;
|
||||
args[0].value = gui.tooltip_bg_pixel;
|
||||
args[1].name = XmNforeground;
|
||||
args[1].value = gui.tooltip_fg_pixel;
|
||||
#else /* Athena */
|
||||
args[0].name = XtNbackground;
|
||||
args[0].value = gui.tooltip_bg_pixel;
|
||||
args[1].name = XtNforeground;
|
||||
args[1].value = gui.tooltip_fg_pixel;
|
||||
#endif
|
||||
XtSetValues(beval->balloonLabel, &args[0], XtNumber(args));
|
||||
}
|
||||
|
||||
XtPopup(beval->balloonShell, XtGrabNone);
|
||||
|
||||
|
||||
123
src/if_cscope.c
123
src/if_cscope.c
@@ -93,12 +93,117 @@ cs_usage_msg(x)
|
||||
(void)EMSG2(_("E560: Usage: cs[cope] %s"), cs_cmds[(int)x].usage);
|
||||
}
|
||||
|
||||
#if defined(FEAT_CMDL_COMPL) || defined(PROTO)
|
||||
|
||||
static enum
|
||||
{
|
||||
EXP_CSCOPE_SUBCMD, /* expand ":cscope" sub-commands */
|
||||
EXP_CSCOPE_FIND, /* expand ":cscope find" arguments */
|
||||
EXP_CSCOPE_KILL /* expand ":cscope kill" arguments */
|
||||
} expand_what;
|
||||
|
||||
/*
|
||||
* Function given to ExpandGeneric() to obtain the cscope command
|
||||
* expansion.
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
char_u *
|
||||
get_cscope_name(xp, idx)
|
||||
expand_T *xp;
|
||||
int idx;
|
||||
{
|
||||
switch (expand_what)
|
||||
{
|
||||
case EXP_CSCOPE_SUBCMD:
|
||||
/* Complete with sub-commands of ":cscope":
|
||||
* add, find, help, kill, reset, show */
|
||||
return (char_u *)cs_cmds[idx].name;
|
||||
case EXP_CSCOPE_FIND:
|
||||
{
|
||||
const char *query_type[] =
|
||||
{
|
||||
"c", "d", "e", "f", "g", "i", "s", "t", NULL
|
||||
};
|
||||
|
||||
/* Complete with query type of ":cscope find {query_type}".
|
||||
* {query_type} can be letters (c, d, ... t) or numbers (0, 1,
|
||||
* ..., 8) but only complete with letters, since numbers are
|
||||
* redundant. */
|
||||
return (char_u *)query_type[idx];
|
||||
}
|
||||
case EXP_CSCOPE_KILL:
|
||||
{
|
||||
int i;
|
||||
int current_idx = 0;
|
||||
static char_u connection[2];
|
||||
|
||||
/* ":cscope kill" accepts connection numbers or partial names of
|
||||
* the pathname of the cscope database as argument. Only complete
|
||||
* with connection numbers. -1 can also be used to kill all
|
||||
* connections. */
|
||||
for (i = 0; i < CSCOPE_MAX_CONNECTIONS; i++)
|
||||
{
|
||||
if (csinfo[i].fname == NULL)
|
||||
continue;
|
||||
if (current_idx++ == idx)
|
||||
{
|
||||
/* Connection number fits in one character since
|
||||
* CSCOPE_MAX_CONNECTIONS is < 10 */
|
||||
connection[0] = i + '0';
|
||||
connection[1] = NUL;
|
||||
return connection;
|
||||
}
|
||||
}
|
||||
return (current_idx == idx && idx > 0) ? (char_u *)"-1" : NULL;
|
||||
}
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Handle command line completion for :cscope command.
|
||||
*/
|
||||
void
|
||||
set_context_in_cscope_cmd(xp, arg)
|
||||
expand_T *xp;
|
||||
char_u *arg;
|
||||
{
|
||||
char_u *p;
|
||||
|
||||
/* Default: expand subcommands */
|
||||
xp->xp_context = EXPAND_CSCOPE;
|
||||
expand_what = EXP_CSCOPE_SUBCMD;
|
||||
xp->xp_pattern = arg;
|
||||
|
||||
/* (part of) subcommand already typed */
|
||||
if (*arg != NUL)
|
||||
{
|
||||
p = skiptowhite(arg);
|
||||
if (*p != NUL) /* past first word */
|
||||
{
|
||||
xp->xp_pattern = skipwhite(p);
|
||||
if (*skiptowhite(xp->xp_pattern) != NUL)
|
||||
xp->xp_context = EXPAND_NOTHING;
|
||||
else if (STRNICMP(arg, "add", p - arg) == 0)
|
||||
xp->xp_context = EXPAND_FILES;
|
||||
else if (STRNICMP(arg, "kill", p - arg) == 0)
|
||||
expand_what = EXP_CSCOPE_KILL;
|
||||
else if (STRNICMP(arg, "find", p - arg) == 0)
|
||||
expand_what = EXP_CSCOPE_FIND;
|
||||
else
|
||||
xp->xp_context = EXPAND_NOTHING;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* FEAT_CMDL_COMPL */
|
||||
|
||||
/*
|
||||
* PRIVATE: do_cscope_general
|
||||
*
|
||||
* find the command, print help if invalid, and the then call the
|
||||
* corresponding command function,
|
||||
* called from do_cscope and do_scscope
|
||||
* Find the command, print help if invalid, and then call the corresponding
|
||||
* command function.
|
||||
*/
|
||||
static void
|
||||
do_cscope_general(eap, make_split)
|
||||
@@ -659,6 +764,7 @@ cs_create_cmd(csoption, pattern)
|
||||
{
|
||||
char *cmd;
|
||||
short search;
|
||||
char *pat;
|
||||
|
||||
switch (csoption[0])
|
||||
{
|
||||
@@ -692,10 +798,17 @@ cs_create_cmd(csoption, pattern)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((cmd = (char *)alloc((unsigned)(strlen(pattern) + 2))) == NULL)
|
||||
/* Skip white space before the patter, except for text and pattern search,
|
||||
* they may want to use the leading white space. */
|
||||
pat = pattern;
|
||||
if (search != 4 && search != 6)
|
||||
while vim_iswhite(*pat)
|
||||
++pat;
|
||||
|
||||
if ((cmd = (char *)alloc((unsigned)(strlen(pat) + 2))) == NULL)
|
||||
return NULL;
|
||||
|
||||
(void)sprintf(cmd, "%d%s", search, pattern);
|
||||
(void)sprintf(cmd, "%d%s", search, pat);
|
||||
|
||||
return cmd;
|
||||
} /* cs_create_cmd */
|
||||
|
||||
@@ -1554,10 +1554,15 @@ recover_names(fname, list, nr)
|
||||
for (i = 0; i < num_files; ++i)
|
||||
if (fullpathcmp(p, files[i], TRUE) & FPC_SAME)
|
||||
{
|
||||
/* Remove the name from files[i]. Move further entries
|
||||
* down. When the array becomes empty free it here, since
|
||||
* FreeWild() won't be called below. */
|
||||
vim_free(files[i]);
|
||||
--num_files;
|
||||
for ( ; i < num_files; ++i)
|
||||
files[i] = files[i + 1];
|
||||
if (--num_files == 0)
|
||||
vim_free(files);
|
||||
else
|
||||
for ( ; i < num_files; ++i)
|
||||
files[i] = files[i + 1];
|
||||
}
|
||||
}
|
||||
if (nr > 0)
|
||||
@@ -3522,7 +3527,7 @@ resolve_symlink(fname, buf)
|
||||
if (errno == EINVAL || errno == ENOENT)
|
||||
{
|
||||
/* Found non-symlink or not existing file, stop here.
|
||||
* When at the first level use the unmodifed name, skip the
|
||||
* When at the first level use the unmodified name, skip the
|
||||
* call to vim_FullName(). */
|
||||
if (depth == 1)
|
||||
return FAIL;
|
||||
@@ -3766,8 +3771,10 @@ do_swapexists(buf, fname)
|
||||
set_vim_var_string(VV_SWAPCHOICE, NULL, -1);
|
||||
|
||||
/* Trigger SwapExists autocommands with <afile> set to the file being
|
||||
* edited. */
|
||||
* edited. Disallow changing directory here. */
|
||||
++allbuf_lock;
|
||||
apply_autocmds(EVENT_SWAPEXISTS, buf->b_fname, NULL, FALSE, NULL);
|
||||
--allbuf_lock;
|
||||
|
||||
set_vim_var_string(VV_SWAPNAME, NULL, -1);
|
||||
|
||||
@@ -3793,6 +3800,7 @@ do_swapexists(buf, fname)
|
||||
*
|
||||
* Note: If BASENAMELEN is not correct, you will get error messages for
|
||||
* not being able to open the swapfile
|
||||
* Note: May trigger SwapExists autocmd, pointers may change!
|
||||
*/
|
||||
static char_u *
|
||||
findswapname(buf, dirp, old_fname)
|
||||
@@ -4560,7 +4568,7 @@ ml_updatechunk(buf, line, len, updtype)
|
||||
buf->b_ml.ml_chunksize + curix,
|
||||
(buf->b_ml.ml_usedchunks - curix) *
|
||||
sizeof(chunksize_T));
|
||||
/* Compute length of first half of lines in the splitted chunk */
|
||||
/* Compute length of first half of lines in the split chunk */
|
||||
size = 0;
|
||||
linecnt = 0;
|
||||
while (curline < buf->b_ml.ml_line_count
|
||||
|
||||
@@ -3023,11 +3023,7 @@ redir_write(str, maxlen)
|
||||
if (*p_vfile != NUL)
|
||||
verbose_write(s, maxlen);
|
||||
|
||||
if (redir_fd != NULL
|
||||
#ifdef FEAT_EVAL
|
||||
|| redir_reg || redir_vname
|
||||
#endif
|
||||
)
|
||||
if (redirecting())
|
||||
{
|
||||
/* If the string doesn't start with CR or NL, go to msg_col */
|
||||
if (*s != '\n' && *s != '\r')
|
||||
@@ -3074,6 +3070,16 @@ redir_write(str, maxlen)
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
redirecting()
|
||||
{
|
||||
return redir_fd != NULL
|
||||
#ifdef FEAT_EVAL
|
||||
|| redir_reg || redir_vname
|
||||
#endif
|
||||
;
|
||||
}
|
||||
|
||||
/*
|
||||
* Before giving verbose message.
|
||||
* Must always be called paired with verbose_leave()!
|
||||
|
||||
@@ -2955,6 +2955,8 @@ change_warning(col)
|
||||
int col; /* column for message; non-zero when in insert
|
||||
mode and 'showmode' is on */
|
||||
{
|
||||
static char *w_readonly = N_("W10: Warning: Changing a readonly file");
|
||||
|
||||
if (curbuf->b_did_warn == FALSE
|
||||
&& curbufIsChanged() == 0
|
||||
#ifdef FEAT_AUTOCMD
|
||||
@@ -2977,8 +2979,10 @@ change_warning(col)
|
||||
if (msg_row == Rows - 1)
|
||||
msg_col = col;
|
||||
msg_source(hl_attr(HLF_W));
|
||||
MSG_PUTS_ATTR(_("W10: Warning: Changing a readonly file"),
|
||||
hl_attr(HLF_W) | MSG_HIST);
|
||||
MSG_PUTS_ATTR(_(w_readonly), hl_attr(HLF_W) | MSG_HIST);
|
||||
#ifdef FEAT_EVAL
|
||||
set_vim_var_string(VV_WARNINGMSG, (char_u *)_(w_readonly), -1);
|
||||
#endif
|
||||
msg_clr_eos();
|
||||
(void)msg_end();
|
||||
if (msg_silent == 0 && !silent_mode)
|
||||
|
||||
11
src/misc2.c
11
src/misc2.c
@@ -496,7 +496,8 @@ check_cursor_col()
|
||||
{
|
||||
colnr_T len;
|
||||
#ifdef FEAT_VIRTUALEDIT
|
||||
colnr_T oldcol = curwin->w_cursor.col + curwin->w_cursor.coladd;
|
||||
colnr_T oldcol = curwin->w_cursor.col;
|
||||
colnr_T oldcoladd = curwin->w_cursor.col + curwin->w_cursor.coladd;
|
||||
#endif
|
||||
|
||||
len = (colnr_T)STRLEN(ml_get_curline());
|
||||
@@ -535,7 +536,13 @@ check_cursor_col()
|
||||
if (oldcol == MAXCOL)
|
||||
curwin->w_cursor.coladd = 0;
|
||||
else if (ve_flags == VE_ALL)
|
||||
curwin->w_cursor.coladd = oldcol - curwin->w_cursor.col;
|
||||
{
|
||||
if (oldcoladd > curwin->w_cursor.col)
|
||||
curwin->w_cursor.coladd = oldcoladd - curwin->w_cursor.col;
|
||||
else
|
||||
/* avoid weird number when there is a miscalculation or overflow */
|
||||
curwin->w_cursor.coladd = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
150
src/ops.c
150
src/ops.c
@@ -72,11 +72,11 @@ static struct yankreg *y_previous = NULL; /* ptr to last written yankreg */
|
||||
*/
|
||||
struct block_def
|
||||
{
|
||||
int startspaces; /* 'extra' cols of first char */
|
||||
int endspaces; /* 'extra' cols of first char */
|
||||
int startspaces; /* 'extra' cols before first char */
|
||||
int endspaces; /* 'extra' cols after last char */
|
||||
int textlen; /* chars in block */
|
||||
char_u *textstart; /* pointer to 1st char in block */
|
||||
colnr_T textcol; /* cols of chars (at least part.) in block */
|
||||
char_u *textstart; /* pointer to 1st char (partially) in block */
|
||||
colnr_T textcol; /* index of chars (partially) in block */
|
||||
colnr_T start_vcol; /* start col of 1st char wholly inside block */
|
||||
colnr_T end_vcol; /* start col of 1st char wholly after block */
|
||||
#ifdef FEAT_VISUALEXTRA
|
||||
@@ -382,15 +382,14 @@ shift_block(oap, amount)
|
||||
{
|
||||
int left = (oap->op_type == OP_LSHIFT);
|
||||
int oldstate = State;
|
||||
int total, split;
|
||||
char_u *newp, *oldp, *midp, *ptr;
|
||||
int total;
|
||||
char_u *newp, *oldp;
|
||||
int oldcol = curwin->w_cursor.col;
|
||||
int p_sw = (int)curbuf->b_p_sw;
|
||||
int p_ts = (int)curbuf->b_p_ts;
|
||||
struct block_def bd;
|
||||
int internal = 0;
|
||||
int incr;
|
||||
colnr_T vcol, col = 0, ws_vcol;
|
||||
colnr_T ws_vcol;
|
||||
int i = 0, j = 0;
|
||||
int len;
|
||||
|
||||
@@ -456,67 +455,89 @@ shift_block(oap, amount)
|
||||
}
|
||||
else /* left */
|
||||
{
|
||||
vcol = oap->start_vcol;
|
||||
/* walk vcol past ws to be removed */
|
||||
for (midp = oldp + bd.textcol;
|
||||
vcol < (oap->start_vcol + total) && vim_iswhite(*midp); )
|
||||
{
|
||||
incr = lbr_chartabsize_adv(&midp, (colnr_T)vcol);
|
||||
vcol += incr;
|
||||
}
|
||||
/* internal is the block-internal ws replacing a split TAB */
|
||||
if (vcol > (oap->start_vcol + total))
|
||||
{
|
||||
/* we have to split the TAB *(midp-1) */
|
||||
internal = vcol - (oap->start_vcol + total);
|
||||
}
|
||||
/* if 'expandtab' is not set, use TABs */
|
||||
colnr_T destination_col; /* column to which text in block will
|
||||
be shifted */
|
||||
char_u *verbatim_copy_end; /* end of the part of the line which is
|
||||
copied verbatim */
|
||||
colnr_T verbatim_copy_width;/* the (displayed) width of this part
|
||||
of line */
|
||||
unsigned fill; /* nr of spaces that replace a TAB */
|
||||
unsigned new_line_len; /* the length of the line after the
|
||||
block shift */
|
||||
size_t block_space_width;
|
||||
size_t shift_amount;
|
||||
char_u *non_white = bd.textstart;
|
||||
colnr_T non_white_col;
|
||||
|
||||
split = bd.startspaces + internal;
|
||||
if (split > 0)
|
||||
{
|
||||
if (!curbuf->b_p_et)
|
||||
{
|
||||
for (ptr = oldp, col = 0; ptr < oldp+bd.textcol; )
|
||||
col += lbr_chartabsize_adv(&ptr, (colnr_T)col);
|
||||
/*
|
||||
* Firstly, let's find the first non-whitespace character that is
|
||||
* displayed after the block's start column and the character's column
|
||||
* number. Also, let's calculate the width of all the whitespace
|
||||
* characters that are displayed in the block and precede the searched
|
||||
* non-whitespace character.
|
||||
*/
|
||||
|
||||
/* col+1 now equals the start col of the first char of the
|
||||
* block (may be < oap.start_vcol if we're splitting a TAB) */
|
||||
i = ((col % p_ts) + split) / p_ts; /* number of tabs */
|
||||
}
|
||||
if (i)
|
||||
j = ((col % p_ts) + split) % p_ts; /* number of spp */
|
||||
else
|
||||
j = split;
|
||||
/* If "bd.startspaces" is set, "bd.textstart" points to the character,
|
||||
* the part of which is displayed at the block's beginning. Let's start
|
||||
* searching from the next character. */
|
||||
if (bd.startspaces)
|
||||
mb_ptr_adv(non_white);
|
||||
|
||||
/* The character's column is in "bd.start_vcol". */
|
||||
non_white_col = bd.start_vcol;
|
||||
|
||||
while (vim_iswhite(*non_white))
|
||||
{
|
||||
incr = lbr_chartabsize_adv(&non_white, non_white_col);
|
||||
non_white_col += incr;
|
||||
}
|
||||
|
||||
newp = alloc_check(bd.textcol + i + j + (unsigned)STRLEN(midp) + 1);
|
||||
block_space_width = non_white_col - oap->start_vcol;
|
||||
/* We will shift by "total" or "block_space_width", whichever is less.
|
||||
*/
|
||||
shift_amount = (block_space_width < total? block_space_width: total);
|
||||
|
||||
/* The column to which we will shift the text. */
|
||||
destination_col = non_white_col - shift_amount;
|
||||
|
||||
/* Now let's find out how much of the beginning of the line we can
|
||||
* reuse without modification. */
|
||||
verbatim_copy_end = bd.textstart;
|
||||
verbatim_copy_width = bd.start_vcol;
|
||||
|
||||
/* If "bd.startspaces" is set, "bd.textstart" points to the character
|
||||
* preceding the block. We have to subtract its width to obtain its
|
||||
* column number. */
|
||||
if (bd.startspaces)
|
||||
verbatim_copy_width -= bd.start_char_vcols;
|
||||
while (verbatim_copy_width < destination_col)
|
||||
{
|
||||
incr = lbr_chartabsize(verbatim_copy_end, verbatim_copy_width);
|
||||
if (verbatim_copy_width + incr > destination_col)
|
||||
break;
|
||||
verbatim_copy_width += incr;
|
||||
mb_ptr_adv(verbatim_copy_end);
|
||||
}
|
||||
|
||||
/* If "destination_col" is different from the width of the initial
|
||||
* part of the line that will be copied, it means we encountered a tab
|
||||
* character, which we will have to partly replace with spaces. */
|
||||
fill = destination_col - verbatim_copy_width;
|
||||
|
||||
/* The replacement line will consist of:
|
||||
* - the beginning of the original line up to "verbatim_copy_end",
|
||||
* - "fill" number of spaces,
|
||||
* - the rest of the line, pointed to by non_white. */
|
||||
new_line_len = (unsigned)(verbatim_copy_end - oldp)
|
||||
+ fill
|
||||
+ (unsigned)STRLEN(non_white) + 1;
|
||||
|
||||
newp = alloc_check(new_line_len);
|
||||
if (newp == NULL)
|
||||
return;
|
||||
vim_memset(newp, NUL, (size_t)(bd.textcol + i + j + STRLEN(midp) + 1));
|
||||
|
||||
/* copy first part we want to keep */
|
||||
mch_memmove(newp, oldp, (size_t)bd.textcol);
|
||||
/* Now copy any TABS and spp to ensure correct alignment! */
|
||||
while (vim_iswhite(*midp))
|
||||
{
|
||||
if (*midp == TAB)
|
||||
i++;
|
||||
else /*space */
|
||||
j++;
|
||||
midp++;
|
||||
}
|
||||
/* We might have an extra TAB worth of spp now! */
|
||||
if (j / p_ts && !curbuf->b_p_et)
|
||||
{
|
||||
i++;
|
||||
j -= p_ts;
|
||||
}
|
||||
copy_chars(newp + bd.textcol, (size_t)i, TAB);
|
||||
copy_spaces(newp + bd.textcol + i, (size_t)j);
|
||||
|
||||
/* the end */
|
||||
STRMOVE(newp + STRLEN(newp), midp);
|
||||
mch_memmove(newp, oldp, (size_t)(verbatim_copy_end - oldp));
|
||||
copy_spaces(newp + (verbatim_copy_end - oldp), (size_t)fill);
|
||||
STRMOVE(newp + (verbatim_copy_end - oldp) + fill, non_white);
|
||||
}
|
||||
/* replace the line */
|
||||
ml_replace(curwin->w_cursor.lnum, newp, FALSE);
|
||||
@@ -4851,7 +4872,8 @@ paragraph_start(lnum)
|
||||
* - textlen includes the first/last char to be (partly) deleted
|
||||
* - start/endspaces is the number of columns that are taken by the
|
||||
* first/last deleted char minus the number of columns that have to be
|
||||
* deleted. for yank and tilde:
|
||||
* deleted.
|
||||
* for yank and tilde:
|
||||
* - textlen includes the first/last char to be wholly yanked
|
||||
* - start/endspaces is the number of columns of the first/last yanked char
|
||||
* that are to be yanked.
|
||||
|
||||
30
src/option.c
30
src/option.c
@@ -6022,15 +6022,23 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf,
|
||||
/* ":set t_Co=0" and ":set t_Co=1" do ":set t_Co=" */
|
||||
if (varp == &T_CCO)
|
||||
{
|
||||
t_colors = atoi((char *)T_CCO);
|
||||
if (t_colors <= 1)
|
||||
int colors = atoi((char *)T_CCO);
|
||||
|
||||
/* Only reinitialize colors if t_Co value has really changed to
|
||||
* avoid expensive reload of colorscheme if t_Co is set to the
|
||||
* same value multiple times. */
|
||||
if (colors != t_colors)
|
||||
{
|
||||
if (new_value_alloced)
|
||||
vim_free(T_CCO);
|
||||
T_CCO = empty_option;
|
||||
t_colors = colors;
|
||||
if (t_colors <= 1)
|
||||
{
|
||||
if (new_value_alloced)
|
||||
vim_free(T_CCO);
|
||||
T_CCO = empty_option;
|
||||
}
|
||||
/* We now have a different color setup, initialize it again. */
|
||||
init_highlight(TRUE, FALSE);
|
||||
}
|
||||
/* We now have a different color setup, initialize it again. */
|
||||
init_highlight(TRUE, FALSE);
|
||||
}
|
||||
ttest(FALSE);
|
||||
if (varp == &T_ME)
|
||||
@@ -7555,9 +7563,13 @@ set_bool_option(opt_idx, varp, value, opt_flags)
|
||||
* set. */
|
||||
if (STRCMP(p_enc, "utf-8") != 0)
|
||||
{
|
||||
static char *w_arabic = N_("W17: Arabic requires UTF-8, do ':set encoding=utf-8'");
|
||||
|
||||
msg_source(hl_attr(HLF_W));
|
||||
MSG_ATTR(_("W17: Arabic requires UTF-8, do ':set encoding=utf-8'"),
|
||||
hl_attr(HLF_W));
|
||||
MSG_ATTR(_(w_arabic), hl_attr(HLF_W));
|
||||
#ifdef FEAT_EVAL
|
||||
set_vim_var_string(VV_WARNINGMSG, (char_u *)_(w_arabic), -1);
|
||||
#endif
|
||||
}
|
||||
|
||||
# ifdef FEAT_MBYTE
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
/* if_cscope.c */
|
||||
char_u *get_cscope_name __ARGS((expand_T *xp, int idx));
|
||||
void set_context_in_cscope_cmd __ARGS((expand_T *xp, char_u *arg));
|
||||
void do_cscope __ARGS((exarg_T *eap));
|
||||
void do_scscope __ARGS((exarg_T *eap));
|
||||
void do_cstag __ARGS((exarg_T *eap));
|
||||
|
||||
@@ -54,6 +54,7 @@ void msg_clr_eos_force __ARGS((void));
|
||||
void msg_clr_cmdline __ARGS((void));
|
||||
int msg_end __ARGS((void));
|
||||
void msg_check __ARGS((void));
|
||||
int redirecting __ARGS((void));
|
||||
void verbose_enter __ARGS((void));
|
||||
void verbose_leave __ARGS((void));
|
||||
void verbose_enter_scroll __ARGS((void));
|
||||
|
||||
109
src/screen.c
109
src/screen.c
@@ -2889,8 +2889,9 @@ win_line(wp, lnum, startrow, endrow, nochange)
|
||||
}
|
||||
else
|
||||
tocol = MAXCOL;
|
||||
if (fromcol == tocol) /* do at least one character */
|
||||
tocol = fromcol + 1; /* happens when past end of line */
|
||||
/* do at least one character; happens when past end of line */
|
||||
if (fromcol == tocol)
|
||||
tocol = fromcol + 1;
|
||||
area_highlighting = TRUE;
|
||||
attr = hl_attr(HLF_I);
|
||||
}
|
||||
@@ -3555,7 +3556,8 @@ win_line(wp, lnum, startrow, endrow, nochange)
|
||||
/* Use line_attr when not in the Visual or 'incsearch' area
|
||||
* (area_attr may be 0 when "noinvcur" is set). */
|
||||
else if (line_attr != 0 && ((fromcol == -10 && tocol == MAXCOL)
|
||||
|| (vcol < fromcol || vcol >= tocol)))
|
||||
|| vcol < fromcol || vcol_prev < fromcol_prev
|
||||
|| vcol >= tocol))
|
||||
char_attr = line_attr;
|
||||
#endif
|
||||
else
|
||||
@@ -4117,6 +4119,7 @@ win_line(wp, lnum, startrow, endrow, nochange)
|
||||
# endif
|
||||
(col < W_WIDTH(wp)))
|
||||
&& !(noinvcur
|
||||
&& lnum == wp->w_cursor.lnum
|
||||
&& (colnr_T)vcol == wp->w_virtcol)))
|
||||
&& lcs_eol_one >= 0)
|
||||
{
|
||||
@@ -4258,7 +4261,7 @@ win_line(wp, lnum, startrow, endrow, nochange)
|
||||
* preedit_changed and commit. Thus Vim can't set "im_is_active", use
|
||||
* im_is_preediting() here. */
|
||||
if (xic != NULL
|
||||
&& lnum == curwin->w_cursor.lnum
|
||||
&& lnum == wp->w_cursor.lnum
|
||||
&& (State & INSERT)
|
||||
&& !p_imdisable
|
||||
&& im_is_preediting()
|
||||
@@ -4267,7 +4270,7 @@ win_line(wp, lnum, startrow, endrow, nochange)
|
||||
colnr_T tcol;
|
||||
|
||||
if (preedit_end_col == MAXCOL)
|
||||
getvcol(curwin, &(curwin->w_cursor), &tcol, NULL, NULL);
|
||||
getvcol(curwin, &(wp->w_cursor), &tcol, NULL, NULL);
|
||||
else
|
||||
tcol = preedit_end_col;
|
||||
if ((long)preedit_start_col <= vcol && vcol < (long)tcol)
|
||||
@@ -4364,7 +4367,13 @@ win_line(wp, lnum, startrow, endrow, nochange)
|
||||
}
|
||||
#endif
|
||||
if (lcs_eol == lcs_eol_one
|
||||
&& ((area_attr != 0 && vcol == fromcol && c == NUL)
|
||||
&& ((area_attr != 0 && vcol == fromcol
|
||||
#ifdef FEAT_VISUAL
|
||||
&& (VIsual_mode != Ctrl_V
|
||||
|| lnum == VIsual.lnum
|
||||
|| lnum == curwin->w_cursor.lnum)
|
||||
#endif
|
||||
&& c == NUL)
|
||||
#ifdef FEAT_SEARCH_EXTRA
|
||||
/* highlight 'hlsearch' match at end of line */
|
||||
|| (prevcol_hl_flag == TRUE
|
||||
@@ -4458,7 +4467,8 @@ win_line(wp, lnum, startrow, endrow, nochange)
|
||||
if (c == NUL)
|
||||
{
|
||||
#ifdef FEAT_SYN_HL
|
||||
if (eol_hl_off > 0 && vcol - eol_hl_off == (long)wp->w_virtcol)
|
||||
if (eol_hl_off > 0 && vcol - eol_hl_off == (long)wp->w_virtcol
|
||||
&& lnum == wp->w_cursor.lnum)
|
||||
{
|
||||
/* highlight last char after line */
|
||||
--col;
|
||||
@@ -4664,7 +4674,7 @@ win_line(wp, lnum, startrow, endrow, nochange)
|
||||
--n_skip;
|
||||
|
||||
/* Only advance the "vcol" when after the 'number' column. */
|
||||
if (draw_state >= WL_SBR
|
||||
if (draw_state > WL_NR
|
||||
#ifdef FEAT_DIFF
|
||||
&& filler_todo <= 0
|
||||
#endif
|
||||
@@ -5131,8 +5141,8 @@ screen_line(row, coloff, endcol, clear_width
|
||||
#endif
|
||||
|
||||
#if defined(FEAT_GUI) || defined(UNIX)
|
||||
/* The bold trick makes a single row of pixels appear in the next
|
||||
* character. When a bold character is removed, the next
|
||||
/* The bold trick makes a single column of pixels appear in the
|
||||
* next character. When a bold character is removed, the next
|
||||
* character should be redrawn too. This happens for our own GUI
|
||||
* and for some xterms. */
|
||||
if (
|
||||
@@ -6275,9 +6285,15 @@ screen_puts_len(text, len, row, col, attr)
|
||||
int pcc[MAX_MCO];
|
||||
# endif
|
||||
#endif
|
||||
#if defined(FEAT_MBYTE) || defined(FEAT_GUI) || defined(UNIX)
|
||||
int force_redraw_this;
|
||||
int force_redraw_next = FALSE;
|
||||
#endif
|
||||
int need_redraw;
|
||||
|
||||
if (ScreenLines == NULL || row >= screen_Rows) /* safety check */
|
||||
return;
|
||||
off = LineOffset[row] + col;
|
||||
|
||||
#ifdef FEAT_MBYTE
|
||||
/* When drawing over the right halve of a double-wide char clear out the
|
||||
@@ -6287,10 +6303,21 @@ screen_puts_len(text, len, row, col, attr)
|
||||
&& !gui.in_use
|
||||
# endif
|
||||
&& mb_fix_col(col, row) != col)
|
||||
screen_puts_len((char_u *)" ", 1, row, col - 1, 0);
|
||||
{
|
||||
ScreenLines[off - 1] = ' ';
|
||||
ScreenAttrs[off - 1] = 0;
|
||||
if (enc_utf8)
|
||||
{
|
||||
ScreenLinesUC[off - 1] = 0;
|
||||
ScreenLinesC[0][off - 1] = 0;
|
||||
}
|
||||
/* redraw the previous cell, make it empty */
|
||||
screen_char(off - 1, row, col - 1);
|
||||
/* force the cell at "col" to be redrawn */
|
||||
force_redraw_next = TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
off = LineOffset[row] + col;
|
||||
#ifdef FEAT_MBYTE
|
||||
max_off = LineOffset[row] + screen_Columns;
|
||||
#endif
|
||||
@@ -6354,7 +6381,12 @@ screen_puts_len(text, len, row, col, attr)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (ScreenLines[off] != c
|
||||
#if defined(FEAT_MBYTE) || defined(FEAT_GUI) || defined(UNIX)
|
||||
force_redraw_this = force_redraw_next;
|
||||
force_redraw_next = FALSE;
|
||||
#endif
|
||||
|
||||
need_redraw = ScreenLines[off] != c
|
||||
#ifdef FEAT_MBYTE
|
||||
|| (mbyte_cells == 2
|
||||
&& ScreenLines[off + 1] != (enc_dbcs ? ptr[1] : 0))
|
||||
@@ -6366,20 +6398,20 @@ screen_puts_len(text, len, row, col, attr)
|
||||
|| screen_comp_differs(off, u8cc)))
|
||||
#endif
|
||||
|| ScreenAttrs[off] != attr
|
||||
|| exmode_active
|
||||
|| exmode_active;
|
||||
|
||||
if (need_redraw
|
||||
#if defined(FEAT_MBYTE) || defined(FEAT_GUI) || defined(UNIX)
|
||||
|| force_redraw_this
|
||||
#endif
|
||||
)
|
||||
{
|
||||
#if defined(FEAT_GUI) || defined(UNIX)
|
||||
/* The bold trick makes a single row of pixels appear in the next
|
||||
* character. When a bold character is removed, the next
|
||||
* character should be redrawn too. This happens for our own GUI
|
||||
* and for some xterms.
|
||||
* Force the redraw by setting the attribute to a different value
|
||||
* than "attr", the contents of ScreenLines[] may be needed by
|
||||
* mb_off2cells() further on.
|
||||
* Don't do this for the last drawn character, because the next
|
||||
* character may not be redrawn. */
|
||||
if (
|
||||
* and for some xterms. */
|
||||
if (need_redraw && ScreenLines[off] != ' ' && (
|
||||
# ifdef FEAT_GUI
|
||||
gui.in_use
|
||||
# endif
|
||||
@@ -6389,23 +6421,14 @@ screen_puts_len(text, len, row, col, attr)
|
||||
# ifdef UNIX
|
||||
term_is_xterm
|
||||
# endif
|
||||
)
|
||||
))
|
||||
{
|
||||
int n;
|
||||
int n = ScreenAttrs[off];
|
||||
|
||||
n = ScreenAttrs[off];
|
||||
# ifdef FEAT_MBYTE
|
||||
if (col + mbyte_cells < screen_Columns
|
||||
&& (n > HL_ALL || (n & HL_BOLD))
|
||||
&& (len < 0 ? ptr[mbyte_blen] != NUL
|
||||
: ptr + mbyte_blen < text + len))
|
||||
ScreenAttrs[off + mbyte_cells] = attr + 1;
|
||||
# else
|
||||
if (col + 1 < screen_Columns
|
||||
&& (n > HL_ALL || (n & HL_BOLD))
|
||||
&& (len < 0 ? ptr[1] != NUL : ptr + 1 < text + len))
|
||||
ScreenLines[off + 1] = 0;
|
||||
# endif
|
||||
if (n > HL_ALL)
|
||||
n = syn_attr2attr(n);
|
||||
if (n & HL_BOLD)
|
||||
force_redraw_next = TRUE;
|
||||
}
|
||||
#endif
|
||||
#ifdef FEAT_MBYTE
|
||||
@@ -6492,6 +6515,20 @@ screen_puts_len(text, len, row, col, attr)
|
||||
++ptr;
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(FEAT_MBYTE) || defined(FEAT_GUI) || defined(UNIX)
|
||||
/* If we detected the next character needs to be redrawn, but the text
|
||||
* doesn't extend up to there, update the character here. */
|
||||
if (force_redraw_next && col < screen_Columns)
|
||||
{
|
||||
# ifdef FEAT_MBYTE
|
||||
if (enc_dbcs != 0 && dbcs_off2cells(off, max_off) > 1)
|
||||
screen_char_2(off, row, col);
|
||||
else
|
||||
# endif
|
||||
screen_char(off, row, col);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef FEAT_SEARCH_EXTRA
|
||||
|
||||
@@ -25,7 +25,8 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \
|
||||
test43.out test44.out test45.out test46.out test47.out \
|
||||
test48.out test51.out test53.out test54.out test55.out \
|
||||
test56.out test57.out test58.out test59.out test60.out \
|
||||
test61.out test62.out test63.out test64.out test65.out
|
||||
test61.out test62.out test63.out test64.out test65.out \
|
||||
test66.out
|
||||
|
||||
.SUFFIXES: .in .out
|
||||
|
||||
@@ -110,3 +111,4 @@ test62.out: test62.in
|
||||
test63.out: test63.in
|
||||
test64.out: test64.in
|
||||
test65.out: test65.in
|
||||
test66.out: test66.in
|
||||
|
||||
@@ -26,7 +26,7 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \
|
||||
test15.out test17.out test18.out test21.out test26.out \
|
||||
test30.out test31.out test32.out test33.out test34.out \
|
||||
test37.out test38.out test39.out test40.out test41.out \
|
||||
test42.out test52.out test65.out
|
||||
test42.out test52.out test65.out test66.out
|
||||
|
||||
SCRIPTS32 = test50.out
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \
|
||||
test15.out test17.out test18.out test21.out test26.out \
|
||||
test30.out test31.out test32.out test33.out test34.out \
|
||||
test37.out test38.out test39.out test40.out test41.out \
|
||||
test42.out test52.out test65.out
|
||||
test42.out test52.out test65.out test66.out
|
||||
|
||||
SCRIPTS32 = test50.out
|
||||
|
||||
|
||||
@@ -25,7 +25,8 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \
|
||||
test43.out test44.out test45.out test46.out test47.out \
|
||||
test48.out test51.out test53.out test54.out test55.out \
|
||||
test56.out test57.out test58.out test59.out test60.out \
|
||||
test61.out test62.out test63.out test64.out test65.out
|
||||
test61.out test62.out test63.out test64.out test65.out \
|
||||
test66.out
|
||||
|
||||
.SUFFIXES: .in .out
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
# Authors: Zoltan Arpadffy, <arpadffy@polarhome.com>
|
||||
# Sandor Kopanyi, <sandor.kopanyi@mailbox.hu>
|
||||
#
|
||||
# Last change: 2008 Aug 19
|
||||
# Last change: 2009 Mar 05
|
||||
#
|
||||
# This has been tested on VMS 6.2 to 8.3 on DEC Alpha, VAX and IA64.
|
||||
# Edit the lines in the Configuration section below to select.
|
||||
@@ -68,7 +68,8 @@ SCRIPT = test1.out test2.out test3.out test4.out test5.out \
|
||||
test43.out test44.out test45.out test46.out \
|
||||
test48.out test51.out test53.out test54.out test55.out \
|
||||
test56.out test57.out test60.out \
|
||||
test61.out test62.out test63.out test64.out test65.out
|
||||
test61.out test62.out test63.out test64.out test65.out \
|
||||
test66.out
|
||||
|
||||
.IFDEF WANT_GUI
|
||||
SCRIPT_GUI = test16.out
|
||||
|
||||
@@ -20,7 +20,7 @@ SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \
|
||||
test48.out test49.out test51.out test52.out test53.out \
|
||||
test54.out test55.out test56.out test57.out test58.out \
|
||||
test59.out test60.out test61.out test62.out test63.out \
|
||||
test64.out test65.out
|
||||
test64.out test65.out test66.out
|
||||
|
||||
SCRIPTS_GUI = test16.out
|
||||
|
||||
|
||||
25
src/testdir/test66.in
Normal file
25
src/testdir/test66.in
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
Test for visual block shift and tab characters.
|
||||
|
||||
STARTTEST
|
||||
:so small.vim
|
||||
/^abcdefgh
|
||||
4jI j<<11|D
|
||||
7|a
|
||||
7|a
|
||||
7|a 4k13|4j<
|
||||
:$-4,$w! test.out
|
||||
:$-4,$s/\s\+//g
|
||||
4kI j<<
|
||||
7|a
|
||||
7|a
|
||||
7|a 4k13|4j3<
|
||||
:$-4,$w >> test.out
|
||||
:qa!
|
||||
ENDTEST
|
||||
|
||||
abcdefghijklmnopqrstuvwxyz
|
||||
abcdefghijklmnopqrstuvwxyz
|
||||
abcdefghijklmnopqrstuvwxyz
|
||||
abcdefghijklmnopqrstuvwxyz
|
||||
abcdefghijklmnopqrstuvwxyz
|
||||
10
src/testdir/test66.ok
Normal file
10
src/testdir/test66.ok
Normal file
@@ -0,0 +1,10 @@
|
||||
abcdefghijklmnopqrstuvwxyz
|
||||
abcdefghij
|
||||
abc defghijklmnopqrstuvwxyz
|
||||
abc defghijklmnopqrstuvwxyz
|
||||
abc defghijklmnopqrstuvwxyz
|
||||
abcdefghijklmnopqrstuvwxyz
|
||||
abcdefghij
|
||||
abc defghijklmnopqrstuvwxyz
|
||||
abc defghijklmnopqrstuvwxyz
|
||||
abc defghijklmnopqrstuvwxyz
|
||||
@@ -676,6 +676,44 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
154,
|
||||
/**/
|
||||
153,
|
||||
/**/
|
||||
152,
|
||||
/**/
|
||||
151,
|
||||
/**/
|
||||
150,
|
||||
/**/
|
||||
149,
|
||||
/**/
|
||||
148,
|
||||
/**/
|
||||
147,
|
||||
/**/
|
||||
146,
|
||||
/**/
|
||||
145,
|
||||
/**/
|
||||
144,
|
||||
/**/
|
||||
143,
|
||||
/**/
|
||||
142,
|
||||
/**/
|
||||
141,
|
||||
/**/
|
||||
140,
|
||||
/**/
|
||||
139,
|
||||
/**/
|
||||
138,
|
||||
/**/
|
||||
137,
|
||||
/**/
|
||||
136,
|
||||
/**/
|
||||
135,
|
||||
/**/
|
||||
|
||||
Reference in New Issue
Block a user