Giter VIP home page Giter VIP logo

Comments (3)

berryzplus avatar berryzplus commented on August 22, 2024 1

サクラエディタ開発当時と現代で「当たり前」の基準が変わってますよね。

::OpenClipboard(hwnd);が成功するまで ::Sleep(0); して数回リトライすべき、の見解です。

(既にどっかに詳細書いた記憶です。)

from sakura.

beru avatar beru commented on August 22, 2024

試してみましたがこちらでは再現しませんでした。EOF行で実行すると(切り取りするデータが無い為に)Cut() に失敗するので警告音が鳴って Paste() が行われます。

ところでサクラエディタのコピーってレイアウト行に限定したコピーなんですね。VS Codeだとロジック行丸ごとのコピーでした。

from sakura.

beru avatar beru commented on August 22, 2024

OpenClipboard は失敗する事が普通にあるんですね、知らなかったです。

https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-openclipboard を読んでみると

OpenClipboard fails if another window has the clipboard open.

と書かれてますね。。

あと検索してヒットした https://groups.google.com/g/scintilla-interest/c/HIuFrgTL8RM?pli=1 には

On Windows the OpenClipboard call, used before reading or writing the clipboard, can fail. This may occur because another application has opened the clipboard. Currently Scintilla fails the Cut/Copy/Paste/… operation when it can not open the clipboard. Normally clipboard operations are driven by the user so do not often overlap. However, sometimes another application such as a clipboard viewer or a virtual machine with a bridged clipboard may be acting on the clipboard in the background. On my main Windows box, it appears that DropBox is causing problems by opening the clipboard when it changes.

It would be possible to retry the OpenClipboard call if it fails. Other APIs, such as the .Net Clipboard.SetDataObject include retry parameters with default behaviour of retrying up to 10 times with a delay between attempts of 100 milliseconds.

  • 他のアプリがクリップボードを開いてると失敗する
  • 通常はクリップボード操作はユーザーが行うので被る事はそんなに無いはずだけど、クリップボードビューワーや仮想マシン、ドロップボックス等のアプリがバックグラウンドで動いていると問題が起きる事がある
  • .NETの Clipboard.SetDataObject にはリトライ用の引数がある。link

というような事が書かれてました。

from sakura.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.