Mark set
Timed out waiting for property-notify event [3 times]
When selecting a large region of code on gnu-emacs like the one shown below I got most of the time the error message above and the command prefix is not recorded (Ctrl-X) so the associated command fails.
Cursor moves becomes very slow. Cancelling the selected region revert cursor moves back to normal.
Note: This is observed through a Real VNC session, no idea if this is related with X or not.
Any idea or workaround ? Thanks.
GNU Emacs 24.3.1 (x86_64-redhat-linux-gnu, GTK+ Version 3.22.30) of
2020-04-03 on x86-01.bsys.centos.org
Code region: 2048 lines of this:
parameter [RAM_DEPTH-1:0] ValueLoad = {
128'h11110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001100101011011010,
128'h00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,
128'h00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,
128'h00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,
128'h00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,
128'h00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,
128'h00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,
128'h00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,
....
128'h00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,
128'h00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,
128'h00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,
128'h01010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
};
Related
How can I force all windows of an NSRunningApplication to come to the foreground? The docs say this should work:
app.activate(options: .activateAllWindows)
But .activateAllWindows seems to have no effect - only the key window comes forward (macOS 12.2).
The Dock manages to achieve this behavior, so I inspected its log and found that it sends a rapp (reopen) AppleEvent to the target app. I tried replicating this event as below:
let app = NSWorkspace.shared.runningApplications.first(where: {$0.bundleIdentifier == "com.apple.Terminal"})!
var pid = app.processIdentifier
let target = NSAppleEventDescriptor(descriptorType: typeKernelProcessID, bytes: &pid, length: MemoryLayout<pid_t>.size)
let event = NSAppleEventDescriptor(eventClass: kCoreEventClass, eventID: kAEReopenApplication, targetDescriptor: target, returnID: AEReturnID(kAutoGenerateReturnID), transactionID: AETransactionID(kAnyTransactionID))
try! event.sendEvent(timeout: TimeInterval(kAEDefaultTimeout))
But no luck. Terminal logs that it receives the event, but no windows are brought forward.
Any other options?
I am building a command line tool in Swift and am wondering if there is any way to determine the current width of the viewport while running the app, in order to limit the text on screen to what will fit without wrapping.
I know this is possible in a "real" command line app, since things like pico, man, pine, etc. all render their textual interfaces based on the window size, but I can't seem to find any info on how they do it.
In fact you can even resize the window while they are running and they will refresh. Does anyone know how this works and if it's possible to add support to a command line tool written in Swift?
The C code from Getting terminal width in C? is easily translated to Swift:
import Darwin
var w = winsize()
if ioctl(STDOUT_FILENO, TIOCGWINSZ, &w) == 0 {
print("rows:", w.ws_row, "cols", w.ws_col)
}
(For some reason, this does not work in the Xcode debugger console,
you have to call the executable in the Terminal window.)
Alternatively, using the ncurses library (from Getting terminal width in C?):
import Darwin.ncurses
initscr()
let s = "rows: \(LINES), cols: \(COLS)"
mvaddstr(1, 1, s);
refresh();
getch()
endwin()
To keep track of window resize events you have to handle the
SIGWINCH signal, compare Trapping signals in a Swift command line application:
import Darwin
import Dispatch
var w = winsize()
if ioctl(STDOUT_FILENO, TIOCGWINSZ, &w) == 0 {
print("rows:", w.ws_row, "cols", w.ws_col)
}
let sigwinchSrc = DispatchSource.makeSignalSource(signal: SIGWINCH, queue: .main)
sigwinchSrc.setEventHandler {
if ioctl(STDOUT_FILENO, TIOCGWINSZ, &w) == 0 {
print("rows:", w.ws_row, "cols", w.ws_col)
}
}
sigwinchSrc.resume()
dispatchMain()
In a normal buffer of nvim, the following ex command works.
:normal! GAabcd
This adds the text "abcd" to the current normal buffer.
But in a terminal buffer of nvim, the above ex command doesn't work!
:normal! GAabcd
This just converts the terminal buffer into '-- TERMINAL --' mode and the "abcd" isn't added!
Why isn't the text added? How can I accomplish that?
I digged the neovim sources and maybe found the answer by myself.
In edit funtion of edit.c, there is the following comment.
bool edit(int cmdchar, bool startln, long count)
{
if (curbuf->terminal) {
if (ex_normal_busy) {
// Do not enter terminal mode from ex_normal(), which would cause havoc
// (such as terminal-mode recursiveness). Instead set a flag to force-set
// the value of `restart_edit` before `ex_normal` returns.
restart_edit = 'i';
force_restart_edit = true;
} else {
terminal_enter();
}
return false;
}
...
I think it means that it's not possible to enter terminal mode(insert mode) while processing normal commands in ex-mode. Therefore the text 'abcd' wasn't added in terminal mode but was just processed as normal commands.
Your answer is correct in that it's not possible to append text using :normal! GAfoo. However, in the interests of answering your last question, you can do this:
:normal! "0p
So if you happen to have what you need in a register, you can always paste it.
I have below code written in xtend :
void doMyMethod(IProgressMonitor monitor, Collection myCollection) {
val subMonitor = SubMonitor.convert(monitor, myCollection.size());
subMonitor.setTaskName("My Task Name...");
myCollection.forEach [ element |
if(subMonitor.canceled || monitor.canceled)
{
throw new OperationCanceledException
}
subMonitor.worked(1)]
}
Meant to stop the progress monitor when user cancels the progress monitor from UI. But is not working. I am following Using prograess monitor, which says can't use monitor.split in eclipse 4.6.
Strangely though if I put a debug point #subMonitor.worked(1) and run the eclipse in debug mode it is working as expected and cancels the monitor if cancels from UI but not working if the debug point is removed. Any idea would be much helpful because I am running short of ideas if debug mode works it should also work without it as well!
I could able to cancel the progress monitor by changing to :
void doMyMethod(IProgressMonitor monitor, Collection myCollection) {
monitor.beginTask(("My Task Name...", myCollection.size());
myCollection.forEach [ element |
if(subMonitor.canceled || monitor.canceled)
{
throw new OperationCanceledException
}
subMonitor.worked(1)] }
thanks
It seems that if Find.Execute finds a result inside a ContentControl, it will cause the ContentControlOnEnter and ContentControlOnExit events to fire. It's particularly annoying because the exit event fires even if the selection is still in the content control, so any code which sets the states of buttons dependent upon a content control being active will appear to be in the incorrect state.
Given a document containing a single content control with the word "test", and the following code:
// In setup
Application.ActiveDocument.ContentControlOnEnter += ActiveDocument_ContentControlOnEnter;
private void ActiveDocument_ContentControlOnEnter(Word.ContentControl ContentControl)
{
var selRange = _Application.Selection.Range;
_logger.Debug(m => m("Selection: {0}-{1}", selRange.Start, selRange.End));
}
//Later in another method
var finder = _Application.ActiveDocument.Range().Find;
_logger.Debug("Find.Execute start");
finder.Execute("test);
_logger.Debug("Find.Execute end");
The following gets logged:
38137 [VSTA_Main] DEBUG - Find.Execute start
38141 [VSTA_Main] DEBUG - Selection: 1-5
38149 [VSTA_Main] DEBUG - Find.Execute end
We have a lot of code that handles ContentControlOnEnter and ContentControlOnExit events, and having the find operation cause them to be called is really causing problems!
Is there any way to use Find.Execute without having it trigger these events? Failing that, is there a good way to distinguish between the Find-triggered ones and the genuine user ones? I have tried using the time between the enter and exit events, but this is not reliable.
I had similar problems in Word, though it was about the Selection event. I tried many solutions, but only one helped. In your case, make a new field bool _skipEnterAndExitEvents and set it true before calling
finder.Execute("test) and false after calling. And in the enter and exit event handlers check this field, if the field is true then just skip. This solutions is not beautiful, looks like a hack, but other solutions are even uglier and don't really work.
I think I found a decent solution:
private bool _doIgnoreNextExit = false;
private void ActiveDocument_ContentControlOnEnter(Word.ContentControl ContentControl)
{
if (Application.Selection.Find.Found)
{
_logger.Debug("Ignoring CC enter event caused by Find operation");
_doIgnoreNextExit = true;
return;
}
// Do things
}
private void ActiveDocument_ContentControlOnExit(Word.ContentControl ContentControl)
{
if(_doIgnoreNextExit)
{
_logger.Debug("Ignoring fake exit");
_doIgnoreNextExit = false;
return;
}
// Do things
}